General SQL Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsDatabasesGeneral SQL Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here
  #1  
Old May 4th, 2004, 10:22 AM
inancgumus inancgumus is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: May 2004
Posts: 2 inancgumus User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Exclamation Finding duplicate rows

Hello,

I want to find out which rows are duplicate by comparing a few of the columns
of the table which those rows resides at.

This is the structure of my table and the columns that I wanna compare:

Code:
CREATE TABLE [dbo].[MediaPlanPublisherRelations] (
[MediaPlanPublisherRelationId] [int] IDENTITY (1, 1) NOT NULL ,
[MediaPlanId] [int] NOT NULL ,
[PublisherId] [int] NOT NULL ,
[RegionId] [int] NOT NULL ,
[CreativeId] [int] NOT NULL ,
[ImpressionByMonth] [int] NOT NULL ,
[ImpressionByPlanned] [int] NOT NULL ,
[PriceOfCPM] [float] NOT NULL ,
[TotalBudgetStatic] [int] NOT NULL ,
[IsEnabled] [bit] NOT NULL 
) ON [PRIMARY]
GO


If (MediaPlanId AND PublisherId AND CreativeId) was equal to a row
in the same table I want to analyze that via some sql query.

Can you explain me, how?

Thanks

Reply With Quote
  #2  
Old May 4th, 2004, 06:37 PM
michlmann michlmann is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Mar 2004
Posts: 56 michlmann User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 5
Try

SELECT t1.*
FROM MediaPlanPublisherRelations t1, MediaPlanPublisherRelations t2
WHERE t1.MediaPlanId=t2.MediaPlanId
AND t1.PublisherId = t2.PublisherId
AND t1.CreativeId = t2.CreativeId
AND t1.MediaPlanPublisherRelationId <> t2.MediaPlanPublisherRelationId

Reply With Quote
  #3  
Old August 25th, 2004, 07:11 AM
bardun bardun is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Aug 2004
Posts: 1 bardun User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Talking

I did not post this question, but it was exactly what I needed. THANK YOU!!!


Bardun
Quote:
Originally Posted by michlmann
Try

SELECT t1.*
FROM MediaPlanPublisherRelations t1, MediaPlanPublisherRelations t2
WHERE t1.MediaPlanId=t2.MediaPlanId
AND t1.PublisherId = t2.PublisherId
AND t1.CreativeId = t2.CreativeId
AND t1.MediaPlanPublisherRelationId <> t2.MediaPlanPublisherRelationId

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsDatabasesGeneral SQL Development > Finding duplicate rows


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway