select * from tbl as a where ColumnB=1 and exists (select * from tbl where ColumnB=0 and ColumnA=a.ColumnA)
select * from 表 t where exists(select 1 from 表 where columnA=t.columnA and columnB+t.columnB=1)
select * from tbl as a where ColumnB=1 and (select IsNull(Count(*),0) from tbl where ColumnB = 0 and ColumnA=a.ColumnA) = 1 Order By ColumnA Asc当有多条ColumnB 为0的纪录,对应一个ColumnA时,建议采用WangZWang(阿来) 的方法。
为何显示ERROR at line 1: ORA-00933: SQL command not properly ended我用的是Oracle9
(select * from tbl where ColumnB=0 and ColumnA=a.ColumnA)
where exists(select 1 from 表 where columnA=t.columnA and columnB+t.columnB=1)
select * from tbl as a where ColumnB=1 and
(select IsNull(Count(*),0) from tbl where ColumnB = 0 and ColumnA=a.ColumnA) = 1
Order By ColumnA Asc当有多条ColumnB 为0的纪录,对应一个ColumnA时,建议采用WangZWang(阿来) 的方法。
ORA-00933: SQL command not properly ended我用的是Oracle9