請幫助我,我有一個如下表,我想通過 id 獲取數據,狀態為“已發送”和“已發送”,而不是狀態為“已交付”。
message_thread_id | 地位 |
---|---|
229 | |
229 | 發表 |
229 | 發送 |
229 | 發表 |
229 | 發表 |
240 | 發送 |
240 | 發送 |
1044 | |
1044 | |
1044 | |
1068 | 發表 |
用 NOT EXISTS
SELECT * FROM mytable a WHERE NOT EXISTS(
SELECT 1 FROM mytable b
WHERE a.message_thread_id = b.message_thread_id
AND status = 'delivered'
)
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句