Let's simplify: On MS SQL Server v7, the following trivial query DOES work -
SELECT count(author_id) as myCounter
FROM author
HAVING count(author_id) > 0
The following (same DB etc), DOES NOT WORK:
SELECT count(author_id) as myCounter
FROM author
WHERE count(author_id) > 0
>I have never been able to reference a name I have assigned to a column in
>the where clause. Also, In an SQL book I have it says "The use of a
>HAVING clause without a corresponding GROUP BY clause is almost never seen
>in practice". (LAN TIMES Guide to SQL)
>
>I would agree with J E VanOver with the following:
>
>SELECT count(tony) as tonysCount, sum(jayme) as jaymesCount from orders
>WHERE Abs((count(tony)-sum(jayme))/count(tony)) > 0
>
>Thanks,
>CC
>
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

