有人可以帮我将连续的重复状态行合并为一个。请参阅下文。
示例:我的当前表:
输出应该是:
答案 0 :(得分:0)
您可以使用GROUP BY
:
SELECT ProductID, Status, MAX([Date]) AS RequestDate
FROM YourTable
GROUP BY ProductID, Status, YEAR([Date])
ORDER BY MAX([Date])
答案 1 :(得分:0)
select productid, status , max([date]) from table
group by productid, status