|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|
|
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
|
|||
|
|||
|
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 |
|
#2
|
|||
|
|||
|
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 |
|
#3
|
|||
|
|||
|
I did not post this question, but it was exactly what I needed. THANK YOU!!!
Bardun Quote:
|
![]() |
| Viewing: Dev Articles Community Forums > Databases > General SQL Development > Finding duplicate rows |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|