A表:
ID STATUS NAME
001 GOOD jk
002 BAD DK
NULL GOOD sd
........ 不要使用in,exists,我的数据量太大,in,exists效率很低。
怎么根据ID好,找出STATUS相同的行?????
例如 当ID=001,得出
001 GOOD jk
NULL GOOD sd
ID STATUS NAME
001 GOOD jk
002 BAD DK
NULL GOOD sd
........ 不要使用in,exists,我的数据量太大,in,exists效率很低。
怎么根据ID好,找出STATUS相同的行?????
例如 当ID=001,得出
001 GOOD jk
NULL GOOD sd
status 相同的行如果说 还有001 GOOD jk
002 BAD DK
NULL GOOD sd
004 linux ls
005 linux ie是不是你要的是重复列呢?
select * from A a
left join
(select status from A where ID = '001')b on a.status = b.status
where b.status is not null;
select a.* from A a left join (select status from A where ID = '001')b on a.status = b.status where b.status is not null;
select a.* from A a
left join
(select distinct status from A where ID = '001')b on a.status = b.status
where b.status is not null;