我面临来自mysql冗余记录的问题如何在这个特定查询中避免这种情况?
$sql = "SELECT DISTINCT d.*,m.*
FROM df_job_meta m
LEFT OUTER JOIN df_job_post d ON d.ID = m.JOB_ID
WHERE (d.STATUS =:ACTIVE)
and ( m.VALUE LIKE :wha )
and d.STATE LIKE :whe
order by d.ID DESC";
答案 0 :(得分:0)
只需添加... GROUP BY d.ID
即可删除重复的ID