Wrox Programmer Forums
|
SQL Server 2000 General discussion of Microsoft SQL Server -- for topics that don't fit in one of the more specific SQL Server forums. version 2000 only. There's a new forum for SQL Server 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server 2000 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 6th, 2007, 01:59 AM
Registered User
 
Join Date: May 2007
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default Urgent - help please

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


 
Old June 6th, 2007, 04:06 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

Vanitha,

Is this by any chance a duplicate post? The other one is posted here.duplicate records If so, posting the same under new thread is not going to help you get better response than posting it clear. Though Jeff had asked for the code in question to be posted here, this has been posted in a new thread.

_________________________
- Vijay G
Strive for Perfection
 
Old June 6th, 2007, 10:42 AM
Authorized User
 
Join Date: Oct 2005
Posts: 72
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Although this may be a duplicate post, I will to answer it. Here's how your query will look like:

SELECT report_id, MIN(sched_id) as sched_id, ID13, ID14, ID15
FROM #tmp
GROUP BY report_id, ID13, ID14, ID15

SQL Server Helper
How well do you know SQL? Find out with the free test assessment from SQL Server Helper!!!
http://www.sql-server-helper.com/free-test/default.aspx

Got a SQL Server Question? Ask us here: http://www.sql-server-helper.com/forums/default.asp





Similar Threads
Thread Thread Starter Forum Replies Last Post
urgent deb_kareng ASP.NET 2.0 Professional 1 August 13th, 2007 07:29 AM
it's urgent deb_kareng ASP.NET 2.0 Professional 3 August 7th, 2007 07:40 AM
urgent help yash_coolbuddy_forindia BOOK: Wrox's ASP.NET 2.0 Visual Web Developer 2005 Express Edition Starter ISBN: 978-0-7645-8807-5 1 May 7th, 2007 08:40 AM
urgent???????????? nsr35 Beginning VB 6 1 October 3rd, 2005 10:57 AM
urgent ??????????????? nsr35 Pro VB Databases 0 October 3rd, 2005 04:53 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.