看板 Database 關於我們 聯絡資訊
※ 引述《iwhiori (玉米)》之銘言: : select a.id from a where a.id not in (select b.id from b) : From http://stackoverflow.com 還可以試試 select a.id from a minus select b.id from b 或 a left join b,找出 b 是 null 的: select a.id from a left join b on a.id = b.id where b.id is null not in 一般會建議寫 not exists, 大部份情況下速度會較佳 select a.id from a where not exists (select 1 from b where b.id = a.id) -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 183.179.61.91 ※ 編輯: adrianshum 來自: 183.179.61.91 (12/31 00:27)
TeemingVoid:推 Alien大大果然厲害! ^^ Exists那段很精采 12/31 01:17
iwhiori:推!!精彩! 12/31 10:22