如何仅选择匹配= 1的匹配MDM组?所以我从:
开始 Score MDM
0 1001961
0 1001961
0 1001961
0 1100406
1 1100794
0 1100794
1 1101109
0 1101109
但我最终应该:
Score MDM
1 1100794
0 1100794
1 1101109
0 1101109
答案 0 :(得分:1)
一种选择是使用exists
:
select score, mdm
from yourtable t
where exists (
select 1
from yourtable t2
where t.mdm = t2.mdm and t2.score = 1
)