Solved

remove duplicate rows based on criteria in SQL Server 2000

Posted on 2011-02-14
3
415 Views
Last Modified: 2012-05-11
Hi, I have some data in SQL where I need to remove duplicates based on certain criteria.  A sample of the data is follows:-

Property      Item      Date      Location
100      G7FIRE      10/10/2010      LOUNGE
100      G6BBU      11/10/2010      LOUNGE
100      G7FIRE      12/10/2010      KITCHEN
101      G6BBU      13/10/2010      LOUNGE
102      G7FIRE      14/10/2010      KITCHEN
105      G7FIRE      10/10/2010      LOUNGE
105      G6BBU      11/10/2010      LOUNGE
105      G7FIRE      12/10/2010      KITCHEN


For properties 100 and 105 there is a G6BBU and a G7FIRE in the SAME location of LOUNGE.  If this is the case then I need to find and remove the G7FIRE.

So for properties where the is a G6BBU and a G7FIRE in the SAME LOCATION (which could be lounge, kitchen, anywhere) I need to remove the G7FIRE line?

Is there an update query that I can run to apply this?

Many thanks,
Deborah
0
Comment
Question by:howsonhome
  • 2
3 Comments
 
LVL 39

Accepted Solution

by:
Pratima Pharande earned 500 total points
ID: 34886840
0
 
LVL 39

Expert Comment

by:Pratima Pharande
ID: 34886849
0
 

Author Closing Comment

by:howsonhome
ID: 34886979
Thanks!!
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
Via a live example, show how to shrink a transaction log file down to a reasonable size.

820 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question