SQL 查詢(xún)一列滿(mǎn)足多個(gè)條件 軟件測試
現有如下表:
列1 列2
5 b
5 c
7 b
8 c
如何查出列2同時(shí)為b和c的結果5來(lái)呢?
先寫(xiě)上復雜的一種查詢(xún):
select distinct a.列1 from (
select 列1
from 表
where 列2=b) a inner join (
select 列1
from 表
where 列2=c) b
on a.列1=b.列1
大家幫幫忙啊?
延伸閱讀
文章來(lái)源于領(lǐng)測軟件測試網(wǎng) http://kjueaiud.com/