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.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 reconstract display seq

Author  Topic 

kalyan.cse05
Yak Posting Veteran

74 Posts

Posted - 2013-07-26 : 07:30:38
i have a table with below data:
shop name display_seq
aaa 9
aaa 10
bbb 8
bbb 9

i need to rearrange the display seq from 1. so the table data will be like:
shop name display_seq
aaa 1
aaa 2
bbb 1
bbb 2

Could someone please help me with the query??
Thanks in advance


kalyan Ashis Dey

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2013-07-26 : 07:44:49
update dt
set display_seq = new_seq
from
(select row_number() over (partition by [shop name] order by display_seq asc) new_seq,* from YourTableName)dt



Too old to Rock'n'Roll too young to die.
Go to Top of Page

kalyan.cse05
Yak Posting Veteran

74 Posts

Posted - 2013-07-26 : 08:51:05
Thanks a lot..it works..:)

kalyan Ashis Dey
Go to Top of Page
   

- Advertisement -