Monday, November 10, 2014

sql server finding duplicate on one column but using select where


sql server finding duplicate on one column but using select where

SELECT Id, Terms, Track, Active
FROM QueryData
WHERE Terms IN (
                SELECT Terms 
                FROM QueryData
                WHERE Track = 'Y' and Active = 'Y' 
                GROUP BY Terms
                HAVING COUNT(*) > 1
                )

SELECT ArticleId
FROM Image2Articles
WHERE ArticleId IN (
                SELECT ArticleId 
                FROM Image2Articles
                
                GROUP BY ArticleId
                HAVING COUNT(*) > 1
                )

No comments:

Post a Comment