|
|
 |
 |
 |
 |
retreive duplicate - urgent
Hi I want to retreive duplicates table report_id sched_id ID13 ID14 ID15 61 1458 COUNTRYWIDE SUPER EAGLE NO 61 1478 CAPITOL SUPER EAGLE NO 61 1450 COUNTRYWIDE SUPER EAGLE NO now sched_id 1458 and 1450 is duplicate my query is select id12,id13,id14,id15,report_id,count(sched_id) as cnt from #tmp group by id12,id13,id14,id15,report_id i want my output to be report_id sched_id ID13 ID14 ID15 61 1458 COUNTRYWIDE SUPER EAGLE NO 61 1450 COUNTRYWIDE SUPER EAGLE NO please help me to solve this. thank you
Please, don't post multiple messages (even if it's urgent). I've responded to your other thread, here: http://groups.google.com/group/microsoft.public.sqlserver.programming... Razvan
-----------------------------------------------Reply-----------------------------------------------
Hi http://dimantdatabasesolutions.blogspot.com/2007/02/dealing-with-dupl... "vanitha" <gvani @firstam.com> wrote in message news:CDC13A0F-9469-4ED4-91D1-07C86C4E02DD@microsoft.com...
> Hi > I want to retreive duplicates > table > report_id sched_id ID13 ID14 ID15 > 61 1458 COUNTRYWIDE SUPER EAGLE NO > 61 1478 CAPITOL SUPER EAGLE NO > 61 1450 COUNTRYWIDE SUPER EAGLE NO > now sched_id 1458 and 1450 is duplicate > my query is > select id12,id13,id14,id15,report_id,count(sched_id) as cnt > from #tmp group by id12,id13,id14,id15,report_id > i want my output to be > report_id sched_id ID13 ID14 ID15 > 61 1458 COUNTRYWIDE SUPER EAGLE NO > 61 1450 COUNTRYWIDE SUPER EAGLE NO > please help me to solve this. > thank you
Vanitha, Hope this help select t.sched_id,rs.id13,rs.id14,rs.id14 from #t t inner join (select count(1) t, report_id,id13,id14,id15 from #t group by report_id,id13,id14,id15 having count(1)>1)rs on rs.report_id =t.report_id and rs.id13=t.id13 and rs.id14=t.id14 and rs.id15=t.id15 Regards Vt Knowledge is power;Share it http://oneplace4sql.blogspot.com "vanitha" <gvani @firstam.com> wrote in message news:CDC13A0F-9469-4ED4-91D1-07C86C4E02DD@microsoft.com...
> Hi > I want to retreive duplicates > table > report_id sched_id ID13 ID14 ID15 > 61 1458 COUNTRYWIDE SUPER EAGLE NO > 61 1478 CAPITOL SUPER EAGLE NO > 61 1450 COUNTRYWIDE SUPER EAGLE NO > now sched_id 1458 and 1450 is duplicate > my query is > select id12,id13,id14,id15,report_id,count(sched_id) as cnt > from #tmp group by id12,id13,id14,id15,report_id > i want my output to be > report_id sched_id ID13 ID14 ID15 > 61 1458 COUNTRYWIDE SUPER EAGLE NO > 61 1450 COUNTRYWIDE SUPER EAGLE NO > please help me to solve this. > thank you
|
 |
 |
 |
 |
|