Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
arkiboys
Master Smack Fu Yak Hacker
1433 Posts |
Posted - 2014-03-27 : 06:18:31
|
Hi,The below table shows a field which has Names in it.Some names are repeated.Name===========FondationBorisBorisMellyocitcovizvizvizvizQuestion:How can each name have a similar ID so that I get the below in order of names:OrderID Name==========================1 Boris1 Boris2 ocitco3 Fondation4 Melly5 viz5 viz5 viz5 vizNot sure if this can be done by row_number() or something different?Thank you |
|
VeeranjaneyuluAnnapureddy
Posting Yak Master
169 Posts |
Posted - 2014-03-27 : 06:31:43
|
select *,Dense_rank() OVER(ORDER BY name) from tablenameVeera |
|
|
arkiboys
Master Smack Fu Yak Hacker
1433 Posts |
Posted - 2014-03-27 : 06:33:41
|
Hi, can the same be done using row_number()?thanks |
|
|
sqlsaga
Yak Posting Veteran
93 Posts |
|
|
|
|