sqlsever 查询最后一条数据
程序员文章站
2022-06-05 08:07:09
select * from(select row_number() over(partition by IDCARD order by DATATM desc) as rownum,* from (SELECT * FROM TABLENAME)as H1 ) as H where H.rownum ......
select * from(select row_number()
over(partition by IDCARD order by DATATM desc) as rownum,*
from (SELECT
*
FROM
TABLENAME
)as H1
) as H where H.rownum =
1
解释:红色为以什么分组 蓝色为以什么排序 紫色为表名 目前是获取表中每个 IDCARD中时间最大的一条
下一篇: 现在老师是这样教学生的