至少 只有 at least only这两种条件用什么实现呢? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 dutysmart (DUTYSMART) '截至2010-03-27 16:23:21 用户结帖率43.28% 总发帖:201 正常结帖:75 未结帖:114 比如name='a'的记录有2条,name='b'的有3条,现在想找只有一条记录的,怎么做呢?如果想找至少有一条记录的怎么做呢? 这样做,查找2条记录的select id ,name from tabwhere name='a'group by idhaving count(name)=2 至少有一条的select id ,name from tabwhere name='a'group by idhaving count(name)>1 select * from a where (select count(*) from b where a.i=b.i)=1;select * from a where (select count(*) from b where a.i=b.i)>0;这样写可以吗 不可以select count(*) from b where a.i=b.i 这条语句返回的很可能是个结果集 没法与0,1进行比较应该使用 group by ...having... 应该是select id from tabgroup by namehaving count(id)>1这样吧? SSH远程exp导出数据库出错 ORA-12170 请教 不限数据库种类,求2道题,能测出面试人员中级数据库开发工程师和高级数据库开发工程师? 紧急求助关于归档问题 求救关于oracle的数据库转移后的新库中使用sqlldr出错。 oracle学习的资料 怪事?请教大家一个问题。 请教一个死锁的问题 表的名字后面有个(IOT)表示什么意思啊? update问题 送分大行动,请问大家如何在ORACLE9I当中创建方案(数据库)? 如何备份partition 不是group by 表达式
'截至2010-03-27 16:23:21 用户结帖率43.28% 总发帖:201 正常结帖:75 未结帖:114
现在想找只有一条记录的,怎么做呢?
如果想找至少有一条记录的怎么做呢?
select id ,name from tab
where name='a'
group by id
having count(name)=2
select id ,name from tab
where name='a'
group by id
having count(name)>1
select * from a where (select count(*) from b where a.i=b.i)>0;这样写可以吗
select count(*) from b where a.i=b.i 这条语句返回的很可能是个结果集 没法与0,1进行比较
应该使用 group by ...having...
select id from tab
group by name
having count(id)>1
这样吧?