Kaptnik (6/12/2013)
Let's say I have this dataset.UserIDEmail
------------------------------------
How do I pick out just one email address for each user id? I'm struggling to write a query to do it.
Just as long as I get a result set with 3 user ids, and 3 email addresses, I'm happy. It doesn't matter which email address is selected.
This:
select
UserID,
from
(select
rn = row_number() over (partition by UserID order by (select null)),
UserID,
from
yourTableNameHere
) dt
where
rn = 1;
Untested, but it should work.