mardi 26 juillet 2016

Serial NO starting from 1

I have a query in which, I want one columns as SR_No which should start from 1

Below is my query

SELECT         
top 2      
 userName,   
 Party_name, 
 Ref_No,
 Ref_date,   
 doc_date,
 Last_Action_date,
 RAName,          
 COUNT(Doc_No) AS CountofDocNo,                  
 Document_Type,           
 RA1_Email                  
FROM #MainTempTable         
 GROUP BY RAName,          
 userName,           
 Document_Type,          
 RA1_Email ,Party_name,Ref_No,
 Ref_date, doc_date,Last_Action_date

order by RAName

How to start it's serial no from 1.

I tried with Row_NUM() but it was not starting from 1.

Aucun commentaire:

Enregistrer un commentaire