表格如下:
User_id Bidid timestamp ... (about 25-30 more columns)
如何提取所有不同的用户ID以及与其关联的所有不同Bidid
以及每个Bidid
唯一的时间戳?
答案 0 :(得分:2)
select distinct
:
select distinct User_id, Bidid, timestamp
from t;
答案 1 :(得分:0)
我认为这可能是您正在寻找的想法,它取决于版本SQL / environment / etc:
SELECT USER_ID, BIDID, TIMESTAMP, ...
FROM THE_TABLE
WHERE BIDID=(SELECT DISTINCT BIDIT FROM THE_TABLE)
或
SELECT USER_ID, BIDID, TIMESTAMP,..
FROM THE_TABLE
WHERE BIDID IN (SELECT DISTINCT BIDIT FROM THE_TABLE)