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 2005 Forums
 Transact-SQL (2005)
 Help me..

Author  Topic 

ganeshkumar08
Posting Yak Master

187 Posts

Posted - 2008-06-18 : 08:53:44
Hi,
This is my query

(select 0 As 'A',playerID,dbo.fn_ResolvePlayerID(playerID) As 'PlayerName' from trendplayers
where player_firstname like 'And%')
union
(select 1 As 'A','-1', '===================================' As 'PlayerName')
union
(select 2 As 'A',playerID,dbo.fn_ResolvePlayerID(playerID) As 'PlayerName' from trendplayers)

In the above first select statement displays the which has PlayerName like 'And%'
second simply displays a like like =======================================
and Third select statement must displays the playername with order by PlayerName.

But in the above query, i was not able to use ORDER BY in the third select Statement.

How can i achieve as below output.

0 90 Andrew JOHNSON
0 144 Andrew TAYLOR
0 152 Andy REID
0 230 Andre BIKEY
0 243 Andy TODD
0 258 Andriy SHEVCHENKO
0 287 Andy VAN DER MEYDE
1 -1 ===================================
2 35 Aaron HUGHES
2 296 Aaron LENNON
2 363 Aaron MOKOENA
2 130 Abdoulaye FAYE
2 125 Abdoulaye MEITE
2 346 Abou DIABY
2 265 Ashley YOUNG
2 549 Bacary SAGNA
2 3 Belozoglu EMRE
2 112 Belozoglu EMRE
2 484 Ben BURGESS

Please help me any one you..

Solutions are easy. Understanding the problem, now, that's the hard part

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2008-06-18 : 08:56:30
Where do you want to show data?
This kind of formation shoule be done at front end application



Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -