1、需求,表 SYS_INFO 的 NAME 字段会重复,按照 创建时间CREATE_AT 字段,取最新一条,其他隐藏
SELECT * FROM (
SELECT T.*,ROW_NUMBER() OVER(PARTITION BY NAME ORDER BY CREATE_AT DESC) AS RN FROM sys_info T
) WHERE RN=1
1、需求,表 SYS_INFO 的 NAME 字段会重复,按照 创建时间CREATE_AT 字段,取最新一条,其他隐藏
SELECT * FROM (
SELECT T.*,ROW_NUMBER() OVER(PARTITION BY NAME ORDER BY CREATE_AT DESC) AS RN FROM sys_info T
) WHERE RN=1