Access and SQL query Issue
Hi All
My Access applcation crash when running this query from Access Query Desinger but work fine in SQL
SQL ---- return 15 rows
SELECT Orders.MID, Orders.TotalValue, Sum(OBook.Value) AS SumOfValue,
min(Orders.CID) AS FirstOfCID,
min(Orders.Customer) AS FirstOfCustomer,
min(Orders.Date) AS FirstOfDate,
Orders.PostToBook, Customers.Rep, Customers.InternalRep,
Count(CountOfProInvoices.CountOfKeyNum) AS CountOfCountOfKeyNum
FROM ((Orders LEFT JOIN OBook ON Orders.MID = OBook.MID)
INNER JOIN Customers ON Orders.CID = Customers.CID)
LEFT JOIN CountOfProInvoices ON Orders.MID = CountOfProInvoices.MID
GROUP BY Orders.MID, Orders.TotalValue, Orders.PostToBook, Customers.Rep, Customers.InternalRep
HAVING (((Sum(OBook.Value))>[TotalValue]+0.01 Or (Sum(OBook.Value))<[TotalValue]-0.01)
AND ((min(Orders.Date))>='16-Apr-2008 ')
AND ((Orders.PostToBook)=1)) OR (((Orders.TotalValue)<>0)
AND ((Sum(OBook.Value)) Is Null) AND ((min(Orders.Date))>=' 16-Apr-2008 ') AND ((Orders.PostToBook)=1))
Access--- This query Hang and no response ultimatly need to shut down access query designer.
SELECT Orders.MID, Orders.TotalValue, Sum(OBook.Value) AS SumOfValue, First(Orders.CID) AS FirstOfCID, First(Orders.Customer) AS FirstOfCustomer, First(Orders.Date) AS FirstOfDate, Orders.PostToBook, Customers.Rep, Customers.InternalRep, Count(CountOfProInvoices.CountOfKeyNum) AS CountOfCountOfKeyNum
FROM ((Orders LEFT JOIN OBook ON Orders.MID = OBook.MID)
INNER JOIN Customers ON Orders.CID = Customers.CID) LEFT JOIN CountOfProInvoices ON Orders.MID = CountOfProInvoices.MID
GROUP BY Orders.MID, Orders.TotalValue, Orders.PostToBook, Customers.Rep, Customers.InternalRep
HAVING (((Sum(OBook.Value))>[TotalValue]+0.01 Or (Sum(OBook.Value))<[TotalValue]-0.01)
AND ((First(Orders.Date))>=#4/16/2008#)
AND ((Orders.PostToBook)=True)) OR (((Orders.TotalValue)<>0)
AND ((Sum(OBook.Value)) Is Null) AND ((First(Orders.Date))>=#4/16/2008#) AND ((Orders.PostToBook)=True));
|