[SQL ] 找出限定條件中發生重複的id
假設現在有一張table是用來儲存team裡的人某天接受測驗不及格的項目與其他詳細內容
id 人 項目 日期 ...
--------------------------
1 A 跳遠 01/02 ...
2 B 短跑 02/15
3 E 跳高 02/17
4 B 跳遠 02/17
5 C 游泳 02/20
6 A 短跑 02/25
如果現在我想知道在限定日期內A和B(或兩人以上)同時不及格項目的ID
像是要求一二月 就會列出像
跳遠 - 1,4
短跑 - 2,6
二月之後就會改列
短跑 - 2,6
我試過用group作
但是重要的ID資訊也一起被合併進去了
請問這樣的sql語法該怎麼下才好呢?
--
《Sometimes Love Just Ain't Enough》 Yan-zi
"But there's a danger in loving somebody too much.
And its sad when you know it's your heart you can't trust.
There's a reason why people don't stay where they are.
Baby sometimes love just ain't enough."
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 210.80.89.18
→
02/24 10:49, , 1F
02/24 10:49, 1F
※ 編輯: CxMacchi 來自: 210.80.89.18 (02/24 11:00)
※ 編輯: CxMacchi 來自: 210.80.89.18 (02/24 11:00)
討論串 (同標題文章)