我有一个语句select ID,Name,Year from tEmp
返回的结果是
zhangsan,张三,23
lisi,李四,24
但是我希望的结果是
1,zhangsan,张三,23
2,lisi,李四,24
怎么写呢?
------解决方案--------------------
select row_number() over(order by getdate()),ID,Name,Year from tEmp
------解决方案--------------------
- SQL code
select fnewId=row_number() over(order by fid),fid,fname,fyear from tEmp
------解决方案--------------------
- SQL code
--05以上select fnewId=row_number() over(order by fid),fid,fname,fyear from tEmp