Reputation: 3
The table is something like:
User_id Bidid timestamp ... (about 25-30 more columns)
How do I pull all the distinct user ids with all the distinct Bidid
's associated with them and also the timestamp which is unique to each Bidid
?
Upvotes: 0
Views: 34
Reputation: 781
I think this could be idea you are looking for, it depends of the version SQL/environment/etc:
SELECT USER_ID, BIDID, TIMESTAMP, ...
FROM THE_TABLE
WHERE BIDID=(SELECT DISTINCT BIDIT FROM THE_TABLE)
or
SELECT USER_ID, BIDID, TIMESTAMP,..
FROM THE_TABLE
WHERE BIDID IN (SELECT DISTINCT BIDIT FROM THE_TABLE)
Upvotes: 0
Reputation: 1270873
select distinct
comes to mind:
select distinct User_id, Bidid, timestamp
from t;
Upvotes: 2