select refdate,
left(convert(varchar,refdate,112),6),
transid,
ROW_NUMBER() over(partition by left(convert(varchar,refdate,112),6) order by RefDate ,TransId ) as rows
from OJDT
SQL Server 排序分组row_number()
最新推荐文章于 2024-10-08 09:27:11 发布
select refdate,
left(convert(varchar,refdate,112),6),
transid,
ROW_NUMBER() over(partition by left(convert(varchar,refdate,112),6) order by RefDate ,TransId ) as rows
from OJDT