Home Forums SQL Server 2012 SQL Server 2012 - T-SQL Selecting rows with distinct values for a column. RE: Selecting rows with distinct values for a column.
Lynn Pettis
SSC Guru
Points: 442467
More actions
June 12, 2013 at 3:42 pm
#1623522
Luis Cazares (6/12/2013)As easy asSELECT UserID, MAX(Email) EmailFROM MyTableIf you need a specific email, you need to define the priority.
Luis Cazares (6/12/2013)
SELECT UserID,
MAX(Email) Email
FROM MyTable
If you need a specific email, you need to define the priority.
Yep, easy except you are missing something:
SELECT
UserID,
FROM
MyTable
GROUP BY
UserID;