Tony,
SQL doesn't do things "in order" it actually starts with the where clause
and works up. This makes sense when you think about it - it filters out the
stuff that you don't want before it selects the stuff that you do.


----- Original Message -----
From: "Tony Weeg" <[EMAIL PROTECTED]>
To: "CF-Talk" <[EMAIL PROTECTED]>
Sent: Wednesday, October 01, 2003 2:28 PM
Subject: RE: sql question pt 2


> that doesn't jive.
> why? because the values of those two things arent calculated until you get
> down into the where clause qualifiers.
>
> isnt there just a way to use those calculated values, referenced in the
> beginning of the query, later on down in the
> query?
>
>
> ...tony
>
> tony weeg
> senior web applications architect
> navtrak, inc.
> www.navtrak.net
> [EMAIL PROTECTED]
> 410.548.2337
>
> -----Original Message-----
> From: J E VanOver [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, October 01, 2003 2:34 PM
> To: CF-Talk
> Subject: RE: sql question pt 2
>
> I just work with SQL Server and there you DON'T use calculated values in
the
> HAVING clause.  You have to re-compute
>
> SELECT count(tony) as tonysCount, sum(jayme) as jaymesCount from orders
> WHERE tony = tony HAVING Abs((count(tony)-sum(jayme))/count(tony)) > 0
>
> -----Original Message-----
> From: Tony Weeg [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, October 01, 2003 11:24 AM
> To: CF-Talk
> Subject: sql question pt 2
>
>
> question:
>
> how does one use calculated variable names(not sure if this is what they
are
> called) in queries, later on in the query?
>
> ie.
>
> select count(tony) as tonysCount, sum(jayme) as jaymesCount from orders
> where tony = tony HAVING
> Abs((tonysCount-jaymesCount)/tonysCount) > 0
>
> the problem is im getting an error like....
>
> Server: Msg 207, Level 16, State 3, Line 1 Invalid column name
'tonysCount'.
> Server: Msg 207, Level 16, State 1, Line 1 Invalid column name
> 'jaymesCount'.
>
> (which tony minus jayme would mean im not married anymore so it would
always
> = 0 :) or would my count go up...hee hee hee, just kidding..
>
> thanks...
>
> ...tony
>
> tony weeg
> senior web applications architect
> navtrak, inc.
> www.navtrak.net
> [EMAIL PROTECTED]
> 410.548.2337
>
>
>
> ________________________________
>
>

[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to