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中時間最大的一條