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

结果如下图:

sql 相同列值统一编号、相同列值自动编号

 

上一篇:Java 内部类私有化


下一篇:Budget Management in SAP