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 |
shantheguy
Starting Member
22 Posts |
Posted - 2013-11-22 : 07:07:00
|
Hi all,I have a scenario like followingC1 C2a 1b 2c 3d 1e 2f 3g 1i have values for first column need to genarate the second column values as shown.Please help out. Thanks in advance. |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2013-11-22 : 07:16:07
|
[code]SELECT C1,((ROW_NUMBER() OVER (ORDER BY C1)-1)%3)+1 AS C2FROM Table[/code]------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/https://www.facebook.com/VmBlogs |
|
|
shantheguy
Starting Member
22 Posts |
Posted - 2013-11-26 : 05:49:46
|
Thanks Visakh... its working |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2013-11-26 : 06:18:06
|
welcome------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/https://www.facebook.com/VmBlogs |
|
|
|
|
|