在使用mysql5.0.40时发现:
exists 和 group by 一起使用时会有问题。表中明明有满足条件的数据,但就是查询不出来。
后来到网上查了下发现是5.0.40的一个bug。
bug地址:
[url]http://bugs.mysql.com/bug.php?id=28337[/url]
解决方法:
升级mysql到5.1.49版本
下载地址:[url]http://www.skycn.com/soft/1262.html[/url]
升级mysql后就OK了。
select sum(fee) sum_fee
from t_bill t1 where 1=1
and exists
(select 1 from t_website t2 where t2.site_id = t1.site_id )
group by site_id
exists 和 group by 一起使用时会有问题。表中明明有满足条件的数据,但就是查询不出来。
后来到网上查了下发现是5.0.40的一个bug。
bug地址:
[url]http://bugs.mysql.com/bug.php?id=28337[/url]
解决方法:
升级mysql到5.1.49版本
下载地址:[url]http://www.skycn.com/soft/1262.html[/url]
升级mysql后就OK了。