请教一条SQL语句 一张表a字段:aa,bb,cc,dd,ee,ff,gg,hh要求:查询有aa字段相同,但bb字段不同的SQL语句。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 select * from a where aa <> bb;select * from a where aa != bb; select aa,bb from agroup by aa,bbhaving count(aa)>1 and count(bb)=1试试 SQL> select * from t1; AA BB CC---------- ---------- ---------- 1 2 3 1 3 3 1 2 3 2 3 4 2 3 4 SQL> SQL> select * from t1 a 2 where exists(select 1 from t1 b where a.aa = b.aa and a.bb != b.bb) 3 ; AA BB CC---------- ---------- ---------- 1 3 3 1 2 3 1 2 3 Orcale中返回自动增长主键问题 请问c++下OCCI如何读写oracle的CLOB字段呢? sql 联表查询1000万条数据 有没有什么好的办法 oracle安装问题 oracle 游标 关于"ORA-00106: 无法在连接到调度程序时启动/关闭数据库"的问题 求教一个sql语句,想了一天了 precise i3(veritas i3) 这个数据库监控软件有没有人使用过? 在WIN2000下,获得ORACLE数据库的名称? 请教:oracle数据库的表信息(字段名,字段类型)存在哪里 oracle是否有这样的函数 查询可访问表的问题!
select * from a where aa != bb;
group by aa,bb
having count(aa)>1 and count(bb)=1
试试
AA BB CC
---------- ---------- ----------
1 2 3
1 3 3
1 2 3
2 3 4
2 3 4
SQL>
SQL> select * from t1 a
2 where exists(select 1 from t1 b where a.aa = b.aa and a.bb != b.bb)
3 ;
AA BB CC
---------- ---------- ----------
1 3 3
1 2 3
1 2 3