count(*) works if I do not alias it with z, and do not use WHERE clause:

mysql> select a,count(*) from aa group by a;
+------+----------+
| a    | count(*) |
+------+----------+
|    1 |        2 |
|    2 |        2 |
|    3 |        2 |
|    4 |        1 |
|    5 |        1 |
|    6 |        1 |
+------+----------+
6 rows in set (0.40 sec)

-----Original Message-----
From: Nathan [mailto:[EMAIL PROTECTED]]
Sent: Friday, January 18, 2002 3:34 PM
To: Rick Emery
Subject: Re: Column Alias Bug??


What does the count(*) do? If that's failing, maybe the alias doesn't get
created?

Shot in the dark obviously... :-)

# Nathan

----- Original Message ----- 
From: "Rick Emery" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, January 18, 2002 2:30 PM
Subject: Column Alias Bug??


Is this a bug?  I can't find an answer to this question in FAQs or archives.

CREATE TABLE aa ( a int);
INSERT INTO aa VALUES (1),(2),(3),(2),(4),(5),(1),(6),(3);

the following :
mysql> select a,count(*) as z from aa where z>1 group by a;

displays this error:
ERROR 1054: Unknown column 'z' in 'where clause'

Why isn't z recognized as a column identifier?


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail
<[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php



---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to