我写的是select * from pp2 where num> (select count(num) from pp2 group by num);
答案是select * from pp2 where number in(select num from pp2 group by num having(count(num)>1)
能帮分析一下答案中的having 的作用吗,以及为什么我的是不是有问题
答案是select * from pp2 where number in(select num from pp2 group by num having(count(num)>1)
能帮分析一下答案中的having 的作用吗,以及为什么我的是不是有问题
解决方案 »
- oracle 怎么修改主键类型
- ora-01489报错字符串过长
- 两条看似很简单的sql,请高手指教
- 如何查看用户对oracle的相关操作
- 关于触发器中“表tablename发生了变化, 触发器/函数不能读它”的一种解决办法
- 新手求教。。。数据内容算加法。。怎么解决
- oracal sequence 在jsp中的问题
- ORA-01591 lock held by in-doubt distributed transaction 17.187.9814
- ORA-28759: Failed to open file该现象应如何解决?
- 怎样使帐户具有SYSDBA的权限?
- sql查找出数据表中第30到第40条记录
- truncate和index的问题
select count(num) from pp2 group by num 可能会返回多个值吧??
你用num>去比较,它不知道比较哪个,所以会出错。。除非你加个any关键字,应该就对了。
select * from pp2 where num> any(select count(num) from pp2 group by num);2.正确的sql
having是分组后过滤,having(count(num)>1意思就是找出num有重复的。。