Site Sponsored By: SQLDSC - SQL Server Desired State Configuration
Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
PropertyId TYPE550 CORRECT550 CORRECT550 WRONG550 WRONG552 CorrectIm looking for a query that will return all ids which are used multiple times for identical identifier such as here TYPE = 'CORRECT'since it came up twice for propertyId = 550That it returns 550 twice
ayamas
Aged Yak Warrior
552 Posts
Posted - 2009-07-28 : 07:58:26
What version of SQL are you using?
Transact Charlie
Master Smack Fu Yak Hacker
3451 Posts
Posted - 2009-07-28 : 08:03:18
Can't you just do this?
SELECT [propertyId] , [TYPE] , COUNT([propertyId]) AS [Times Repeated]FROM <<yourtable>>GROUP BY [propertyId] , [TYPE]HAVING COUNT([propertyId]) > 1
Charlie===============================================================Msg 3903, Level 16, State 1, Line 1736The ROLLBACK TRANSACTION request has no corresponding BEGIN TRANSACTION