找不一个表中重复的数据,进行分组显示!
select p.name PropertyName,a.property_id,c.name ContentName,a.CONTENT_ID contentId,a.cpc DataCount from (select count(*) cpc,property_id ,content_id from content_property where property_id not in (15884973,15884979,15884981,15884965)
and content_id in(select id from content where csp_id in (15905690,16241840,16241843))group by property_id ,content_id) a,property p,content cwhere a.cpc > 1 and p.id=a.property_id and c.id=a.content_id order by a.content_id desc ;
/*查询重复的数据 */
select * from content_property a
where (a.property_id,a.content_id) in (select property_id,content_id from content_property
group by property_id,content_id having count(*) > 1)and property_id not in (15884973,15884979,15884981,15884965)
and content_id in(select id from content where csp_id in (15905690,16241840,16241843));
/*删除重复的数据 */
select *from content_property a
where (a.property_id,a.content_id) in (select property_id,content_id from content_property
group by property_id,content_id having count(*) > 1)and property_id not in (15884973,15884979,15884981,15884965)
and content_id in(select id from content where csp_id in (15905690,16241840,16241843))
and id not in (select max(id) from content_property group by property_id,content_id having count(*)>1);
select max(id) from content_property group by property_id,content_id having count(*)>1;