It does.  On the first line I'm doing a SELECT *.  that would include the
OrderDate column, would it not?

----- Original Message -----
From: "I-Lin Kuo" <[EMAIL PROTECTED]>
To: "CF-Talk" <[EMAIL PROTECTED]>
Sent: Thursday, July 08, 2004 10:31 AM
Subject: Re: Query of a query inconsistancies

> Logically, they're different. You shouldn't get any
> results by moving the orderdate condition to the
> bottom query, because qryGetRepeatSales doesn't have a
> date column
>
> --- Todd <[EMAIL PROTECTED]> wrote:
> > 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]

Reply via email to