I have these 2 queries:
<cfquery datasource="#Application.Read#" name="qryGetRepeatSales">
SELECT *, COUNT(*) AS totalcount, SUM(Cost) AS totalcost
FROM orders, orderitems
WHERE orders.OrderID = orderitems.OrderID
AND OrderDate >= '#DateFormat(StartTime, "yyyy-mm-dd")#'
GROUP BY UserID
HAVING totalcount > 1
</cfquery>
<cfquery dbtype="query" name="qrySubGetRepeatSales">
SELECT SUM(totalcost) AS totalcost, COUNT(totalcount) AS totalcount
FROM qryGetRepeatSales
</cfquery>
The problem I'm having is when the "OrderDate" line is in the top query, I get the correct results. If I move it to the bottom query, the totalcost and totalcount end up being 1 or 2 less. The date filter really needs to be in the bottom query. What am I missing?
[Todays Threads]
[This Message]
[Subscription]
[Fast Unsubscribe]
[User Settings]
[Donations and Support]
- Re: Query of a query inconsistancies Todd
- Re: Query of a query inconsistancies I-Lin Kuo
- Re: Query of a query inconsistancies Todd Ashworth
- Re: Query of a query inconsistancies Jochem van Dieten
- Re: Query of a query inconsistancies Todd Ashworth
- RE: Query of a query inconsistancies Barney Boisvert
- Re: Query of a query inconsistanci... Jochem van Dieten
- RE: Query of a query inconsist... Barney Boisvert
- Re: Query of a query incon... Jochem van Dieten
- RE: Query of a query incon... Barney Boisvert
- Re: Query of a query incon... Jochem van Dieten