(SELECT *
FROM (SELECT ROW_NUMBER() OVER (PARTITION BY MachineId ORDER BY ReportDateTime DESC) RowNum,
dbo.MachineFault.*
FROM dbo.MachineFault )
AS t1
WHERE RowNum = 1 )
AS ReportTable
(SELECT *
FROM (SELECT ROW_NUMBER() OVER (PARTITION BY MachineId ORDER BY ReportDateTime DESC) RowNum,
dbo.MachineFault.*
FROM dbo.MachineFault )
AS t1
WHERE RowNum = 1 )
AS ReportTable
本文标题:使用Row_Number()取出第一条数据
本文链接:https://www.haomeiwen.com/subject/gtmluttx.html
网友评论