List:General Discussion« Previous MessageNext Message »
From:Gerald L. Clark Date:March 20 2001 4:37pm
Subject:Re: select ... having bug?
View as plain text  
Having works on the result table, not the source tables.
Since you did not select cnt, having can not examine it.

Maybe you ment 'where' instead of 'having' ?

\"Piotr Gapinski\" wrote:
> 
> small problems with query below...
> my fault?
> 
> mysql> desc poll_answer;
> +---------+-------------+------+-----+---------+-------+
> | Field   | Type        |Null  | Key | Default | Extra |
> +---------+-------------+------+-----+---------+-------+
> | poll_id | int(10)     |      |     | 0       |       |
> | cnt     | int(10)     |      |     | 0       |       |
> | answer  | varchar(60) |      |     |         |       |
> +---------+-------------+------+-----+---------+-------+
>  3 rows in set (0.00 sec)
> 
> mysql> select answer from poll_answer having cnt=1;
> ERROR 1054: Unknown column 'cnt' in 'having clause'
> 
> mysqladmin Ver 8.18 Distrib 3.23.35, for pc-linux-gnu on i686 -- Copyright
> (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
> This software comes with ABSOLUTELY NO WARRANTY.
> This is free software, and you are welcome to modify and redistribute it
> under the GPL license
> 
> Server version 3.23.35 Protocol version 10 Connection Localhost via UNIX
> socket UNIX socket /var/lib/mysql/mysql.sock Uptime:  3 days 10 hours 24
> min 20 sec
> 
> Threads: 1  Questions: 4192  Slow queries: 0  Opens: 116  Flush tables: 1
> Open tables: 23 Queries per second avg: 0.014
> 
> --
>   Piotr Gapinski mailto:news@stripped
> 
> ---------------------------------------------------------------------
> 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 <mysql-thread68797@stripped>
> To unsubscribe, e-mail
> <mysql-unsubscribe-gerald_clark=suppliersystems.com@stripped>
> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
Thread
join from two different databasesRichard Reina18 Mar
  • Re: join from two different databasesc.smart18 Mar
    • Re: join from two different databasesMarc Billiet18 Mar
  • Re: join from two different databasesFred van Engen18 Mar
Re: join from two different databasesAndreas Vierengel20 Mar
  • select ... having bug?\"Piotr Gapinski\"20 Mar
    • Re: select ... having bug?Bill Marrs20 Mar
    • Re: select ... having bug?Gerald L. Clark20 Mar