sql 相同列值统一编号、相同列值自动编号
作者:互联网
select
ROW_NUMBER() over(order by t1.new_machineName) as N'自动编号',
DENSE_RANK() over(order BY t1.new_machineName) AS N'相同列值统一编号',
ROW_NUMBER() over(partition by t1.new_machineName Order by t1.new_machineName ASC,t1.statuscode asc,t1.new_stopdate desc) as N'相同列值自增编号',
t1.new_machineName,
t1.statuscode,
t1.new_stopdate,
t1.new_customercontractName
from new_contractmachine t1
结果如下图:
标签:相同,machineName,over,t1,编号,new,列值 来源: https://www.cnblogs.com/dmei/p/15234091.html