SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 reconstract display seq
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

kalyan.cse05
Yak Posting Veteran

India
74 Posts

Posted - 07/26/2013 :  07:30:38  Show Profile  Reply with Quote
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
Flowing Fount of Yak Knowledge

Germany
8765 Posts

Posted - 07/26/2013 :  07:44:49  Show Profile  Visit webfred's Homepage  Reply with Quote
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

India
74 Posts

Posted - 07/26/2013 :  08:51:05  Show Profile  Reply with Quote
Thanks a lot..it works..:)

kalyan Ashis Dey
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.03 seconds. Powered By: Snitz Forums 2000