October 25, 2011 at 9:27 am
Table Data
---------------------------
ID Dept-ID Version
10 30 0
20 30 0
20 30 1
20 40 2
30 50 0
30 50 1
30 60 2
40 30 0
40 30 1
-------------
Expected Output
ID
20
30
October 25, 2011 at 9:46 am
SELECT ID FROM dbo.Table GROUP BY ID HAVING COUNT(*) > 1
October 25, 2011 at 9:52 am
I guess this won't return the expected output. It will return even 40 as well which is not the desired output.
October 25, 2011 at 9:56 am
SELECT ID FROM dbo.Table
GROUP BY ID
HAVING COUNT(DISTINCT DepartmentId) > 1
October 25, 2011 at 10:23 am
THNKS FOR THE rEPLY
Viewing 5 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy