sql查找不重复数据 去重
SELECT * FROM table1 a left join table2 as m on a.mid=m.mid WHERE EXISTS ( SELECT 1 FROM ( SELECT MAX(gid) AS gid , MAX(zhx) AS zhx , gname FROM table1 GROUP BY gname ) b WHERE a.gname = b.gname AND a.zhx = b.zhx AND A.gid = b.gid )
SELECT * FROM table1 a left join table2 as m on a.mid=m.mid WHERE EXISTS ( SELECT 1 FROM ( SELECT MAX(gid) AS gid , MAX(zhx) AS zhx , gname FROM table1 GROUP BY gname ) b WHERE a.gname = b.gname AND a.zhx = b.zhx AND A.gid = b.gid )