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
 SQL Server 2008 Forums
 Transact-SQL (2008)
 can help with another t-sql ?

Author  Topic 

CKHong
Starting Member

13 Posts

Posted - 2010-03-26 : 02:26:54
[RowAsc] [countID] [Title]
1 1 AA
2 1 AA
3 1 AA
4 1 BB
5 1 BB
6 1 BB
7 1 BB
8 1 BB
1 2 AA
2 2 AA
3 2 AA
4 2 AA
5 2 BB
6 2 BB
7 2 BB
8 2 BB

The RowAsc result i got it from a query :
Row_Number()OVER(Partition by A.CountID Order by A.Title) AS rowAsc

I wanted to get the result as below:

[RowAsc] [countID] [Title]
1 1 AA
2 1 AA
3 1 AA
1 1 BB
2 1 BB
3 1 BB
4 1 BB
5 1 BB
1 2 AA
2 2 AA
3 2 AA
4 2 AA
1 2 BB
2 2 BB
3 2 BB
4 2 BB

Any idea ??

CKHong
Starting Member

13 Posts

Posted - 2010-03-26 : 02:32:46
opps... just found out the solution... here it is :

Row_Number()OVER(Partition by A.CountID, A.Title Order by A.Title) AS rowAsc

:D
Go to Top of Page

haroon2k9
Constraint Violating Yak Guru

328 Posts

Posted - 2010-03-26 : 02:39:04
Good
Go to Top of Page

senthil_nagore
Master Smack Fu Yak Hacker

1007 Posts

Posted - 2010-03-26 : 02:39:59
Good! Great to share here!

Senthil.C
------------------------------------------------------
[Microsoft][ODBC SQL Server Driver]Operation canceled

http://senthilnagore.blogspot.com/
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2010-03-26 : 02:51:27
that's good. CKHong boleh.


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

CKHong
Starting Member

13 Posts

Posted - 2010-03-26 : 06:10:01
HAHAHAAA... thx...
b4 tat.. duno can put 2 partition.. lol ~~
thx thx...
Go to Top of Page
   

- Advertisement -