Want to sequence with SQL query. Is there any shorter way to update it, or should I update the whole table.
My table as follows:
DECLARE @tab TABLE (ID INT IDENTITY, Name VARCHAR(10), Seq INT)
INSERT INTO @tab VALUES('A',1),('B',1),('C',1),('D',3),('E',4),('F',5),('G',6),('H',7),('I',8)
SELECT * FROM @tab ORDER BY Seq
I want to change the sequence show column with ID 7, 8, 9 at the top. My desired output should be
DECLARE @tab TABLE (ID INT IDENTITY, Name VARCHAR(10), Seq INT)
INSERT INTO @tab VALUES('A',4),('B',5),('C',6),('D',7),('E',8),('F',9),('G',1),('H',2),('I',3)
SELECT * FROM @tab ORDER BY Seq
order by Seq desc?ROW_NUMBER?