with RankedRecords AS
(SELECT *, ROW_NUMBER() over(partition by taskid ORDER BY operatedate desc, operatetime desc) AS RowNum
FROM TM_TaskLog
WHERE type = 6 )
select * from RankedRecords
你可以把sql 修改为使用子查询的方式,比如,
select * from (
SELECT *, ROW_NUMBER() over(partition by taskid ORDER BY operatedate desc, operatetime desc) AS RowNum
FROM TM_TaskLog
WHERE type = 6
) as RankedRecords
你可以把sql 修改为使用子查询的方式,比如,
select * from (
SELECT *, ROW_NUMBER() over(partition by taskid ORDER BY operatedate desc, operatetime desc) AS RowNum
FROM TM_TaskLog
WHERE type = 6
) as RankedRecords