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]

