想把COUNT放到where子句中?
嘿嘿,这就说明你的数据库课没有学好……
错误做法:select * from user_num where count(user)>=2 group by user;
正确做法:select * from user_num group by user HAVING count(user)>=2 ;
用having子句吧!
相关文章
- No Related Posts
嘿嘿,这就说明你的数据库课没有学好……
错误做法:select * from user_num where count(user)>=2 group by user;
正确做法:select * from user_num group by user HAVING count(user)>=2 ;
用having子句吧!
只有思想的碰撞才能产生火花!请留下你宝贵的评论吧:
hehe 于 2007-10-26 @ 22:24:37 留言 :
[ 引用 ]错误做法:select * from user_num where count(user)>=2 group by user;
正确做法:select * from user_num group by user HAVING count(user)>=2 ;
这个我这样写可以吗?
select count(user)>=2 from user_num;
berg 于 2007-10-28 @ 14:28:42 留言 :
[ 引用 ][Quote ID #60748]
如果是mysql,应该是不行的
select count(user) as usernum from user_num where usernum>=2;
上面这样没问题
大大 于 2007-11-04 @ 12:19:50 留言 :
[ 引用 ]写的不错正好拿来连手~http://www.bizhitu.cn