Forum Moderators: coopster

Message Too Old, No Replies

select question

         

bobnew32

12:58 am on Dec 1, 2004 (gmt 0)

10+ Year Member



I have a table called 'reviews'. For each row, it has the column 'user_id' located in it. What I want to do is select every 'user_id' in that table, but only do it once. I'm completely stumped on how I would go about doing this though...?

An example to show as well:

table reviews {
name:abc ¦ user_id: 1
name:def ¦ user_id: 3
name:jkj ¦ user_id: 1
}

It would return to me: (1,3).

coopster

1:29 am on Dec 1, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Use the DISTINCT keyword.
SELECT DISTINCT user_id FROM reviews;

bobnew32

1:33 am on Dec 1, 2004 (gmt 0)

10+ Year Member



Darn, I knew it had something to do with distinct! Thanks coop!