I am trying to create a query that numbers my rows and the change of empid, it starts over.. I was looking at some blog on Row_number() but cannot seem to get it to work. Below is my current query, any suggestions would be greatly appreciated!!
EXECUTE adm_Supplimental
SELECT
row_number() over (order by empid) as Row,
k.empid,
'Job Title' = CONVERT(nvarchar, DecryptByKey(p1.[job])),
'Job Start' = CONVERT(datetime, CONVERT(nvarchar, DecryptByKey(p1.[Start Date]))),
'Grade' = CONVERT(nvarchar, DecryptByKey(p8.[Pay Scale Level])),
'Grade Start' = CONVERT(datetime, CONVERT(nvarchar, DecryptByKey(p8.[Start Date])))
from Kims_CompAuditIDs k
inner join ystdy_PA0001 P1 on P1.sapid = k.empid
inner join ystdy_PA0008 P8 on p8.sapid = k.empid
This numbers the rows, but does not start over at the change of empid?
Thanks a million!!!
EXECUTE adm_Supplimental
SELECT
row_number() over (order by empid) as Row,
k.empid,
'Job Title' = CONVERT(nvarchar, DecryptByKey(p1.[job])),
'Job Start' = CONVERT(datetime, CONVERT(nvarchar, DecryptByKey(p1.[Start Date]))),
'Grade' = CONVERT(nvarchar, DecryptByKey(p8.[Pay Scale Level])),
'Grade Start' = CONVERT(datetime, CONVERT(nvarchar, DecryptByKey(p8.[Start Date])))
from Kims_CompAuditIDs k
inner join ystdy_PA0001 P1 on P1.sapid = k.empid
inner join ystdy_PA0008 P8 on p8.sapid = k.empid
This numbers the rows, but does not start over at the change of empid?
Thanks a million!!!