我有一张桌子A.
ID Term
10 A
10 B
10 C
20 A
20 B
20 E
Run Code Online (Sandbox Code Playgroud)
什么是编写SQL的最佳方法
.
Select distinct ID from TableA where Term in (A,B,C) will return both 10 and 20
Select distinct ID from TableA where Term in (A,B) will also return both 10 and 20
Select distinct ID from TableA where Term NOT in (C,D) will also return both 10 and 20
Run Code Online (Sandbox Code Playgroud)
谢谢!
sql ×1