目前我有以下表格:
ID Date Number
-------------------------------------------------------
F78D56A2-5BF1-4172-90BA-23CAF6A05A10 NULL NULL
F78D56A2-5BF1-4172-90BA-23CAF6A05A10 NULL NULL
F78D56A2-5BF1-4172-90BA-23CAF6A05A10 NULL 001234
F78D56A2-5BF1-4172-90BA-23CAF6A05A10 2018-11-30 NULL
请求的输出是:
ID Date Number
-------------------------------------------------------
F78D56A2-5BF1-4172-90BA-23CAF6A05A10 2018-11-30 001234
当然你不能使用group by
,因为这需要更多的论据。我怎么能这样做?
答案 0 :(得分:3)
您可以尝试加入以避免GROUP BY
SELECT T1.Id, MAX(T1.Date) AS Date, MAX(T1.Number) As Number
FROM YourTableName AS T1
JOIN YourTableName AS T2 ON T1.column_name = T2.column_name;