MySQLdb select

Sibylle Koczian Sibylle.Koczian at Bibliothek.Uni-Augsburg.de
Fri Aug 6 06:24:03 EDT 2004


Andy Todd schrieb:
> It's a bug. I think it is a bug in MySQL. I'm using 4.0.18 on Debian and 
> an interactive session shows the problem;
> 
> """
> andy47 at vetinari:~$ mysql
[snip]
> Database changed
> mysql> select count(*) from stock_prices where price_date = '2004-07-30';
> +----------+
> | count(*) |
> +----------+
> |        7 |
> +----------+
> 1 row in set (0.00 sec)
> 
> mysql> select count(*) from stock_prices where price_date = '2004-07-30 
> 00:00:00';
> +----------+
> | count(*) |
> +----------+
> |        7 |
> +----------+
> 1 row in set (0.00 sec)
> """
> 
> When using '=' the two forms of date are identical, but if we switch to 
> using 'in';
> 
> """
> mysql> select count(*) from stock_prices where price_date in 
> ('2004-07-30');
> +----------+
> | count(*) |
> +----------+
> |        7 |
> +----------+
> 1 row in set (0.00 sec)
> 
> mysql> select count(*) from stock_prices where price_date in 
> ('2004-07-30 00:00:00');
> +----------+
> | count(*) |
> +----------+
> |        0 |
> +----------+
> 1 row in set (0.00 sec)
> 
> mysql>
> """
> 
> Ta-da. Of course, this may have already been notified to MySQL AB, I'd 
> check their web site (http://www.mysql.com) or try one of their mailing 
> lists.
> 
Will do. Thank you. I never thought of trying this directly in MySQL, 
always took it for a problem between MySQL and Python. I'll check the 
MySQL newsgroup first, as it's in German.

Koczian



More information about the Python-list mailing list