如何在显示mysql记录时停止冗余

时间:2015-01-19 15:00:18

标签: php mysql pdo

我面临来自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";

1 个答案:

答案 0 :(得分:0)

只需添加... GROUP BY d.ID即可删除重复的ID