SELECT DISTINCT * FROM nA RIGHT JOIN nB ON nA.a=nB.a AND nA.b=nB.b WHERE f=1
但是实际查询结果: aid a b c bid f 0 1 1 1 1 1 1 2 3 4 0 1 2 1 1 1 1 1
怎样将其中的重复值去掉?
------解决方案-------------------- 假设AID唯一 SELECT * FROM nA a inner JOIN nB ON nA.a=nB.a AND nA.b=nB.b 个 where not exists(select 1 from na where a.a=a and a.b=b amd a.aid>aid)
------解决方案--------------------
SELECT * FROM nA RIGHT JOIN nB ON nA.a=nB.a AND nA.b=nB.b WHERE f=1 group By nA.a, nA.b
------解决方案--------------------