SELECT * from t_ss;
SELECT * from t_kk;
SELECT * from t_ss s LEFT JOIN t_kk k on s.id=k.sid
使用group by去重
SELECT * from t_ss s LEFT JOIN t_kk k on s.id=k.sid GROUP BY k.sid;
或者
SELECT * from t_ss s LEFT JOIN t_kk k on s.id=k.sid GROUP BY s.id;
如果要去重,统计数量,就用DISTINCT
SELECT count(DISTINCT s.id) from t_ss s LEFT JOIN t_kk k on s.id=k.sid