Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Getting Row No in Select query
Message
 
 
À
13/01/2002 23:52:52
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Autre
Divers
Thread ID:
00604151
Message ID:
00604661
Vues:
25
This message has been marked as the solution to the initial question of the thread.
You can use following query.
select t1.emp_name, 
(SELECT COUNT(*) FROM emp_mst a2 
  WHERE t2.emp_name + CAST( t2.emp_id AS char(10)) <= 
        t1.emp_name + CAST( t1.emp_id AS char(10)) ) AS Sequence
FROM emp_mst a1 
ORDER BY t1.emp_name + CAST( t1.emp_id AS char(10))
If 'emp_name' is unique you can remove CAST( t*.emp_id AS char(10)) ) from the query.

>Hello,
>
> i want the absolute row no while selecting the records from the table.
>e.g. Select name from Emp_mst
>so i want the o/p like
>Srl. No.        Name
>-------------------------
>1               abc
>2               xyz
>how should i do this ?????
>
>
>Thanx in advance,
>Amol
--sb--
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform