Using T-SQL.
My problem is I have a list of usersid
and locationid
.
A user can only have one location.
With the following query I get a list with all users with multiple location id's:
SELECT *
FROM Userslocation
WHERE [USER] IN (
SELECT [USER]
FROM Userslocation
GROUP BY [User]
HAVING COUNT(*) > 1
)
as result I get
location User
80653 83269
63150 83269
80653 84035
63150 84035
80653 85097
63150 85097
I want to get preserve one result and delete the rest
location User
80653 83269
80653 84035
80653 85097