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)
 select a subset of rows from league - help!

Author  Topic 

cooleofooleo
Starting Member

2 Posts

Posted - 2007-07-07 : 07:29:39
I have a league with 15 teams, but I only want to show 5 teams at a time. However, one of these teams must be my team (TeamX).
So I need a select statement that will find TeamX and will return 5 teams with 3 teams above and 1 below it.
However, if TeamX is within the top 3, I just need to display the top 5 teams, and if TeamX is bottom of the league, I just need to display the 4 teams above it!

I have absolutely no idea how to go about doing this! Im using a mySQL database, developing an asp.net website with c#.net. (Sorry Microsoft - but cant afford SQL Server!)

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2007-07-07 : 07:32:37
quote:
Im using a mySQL database

Then you should post at MySQL forum. This is a Microsoft SQL Server site.


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

Go to Top of Page

chrispy
Posting Yak Master

107 Posts

Posted - 2007-07-07 : 16:12:55
Mental note to self :

If I need help from the experts here, never mention MySQL, just translate the T-SQL, or...... get on a better team so I do not have the fudge the stats. :)
Go to Top of Page
   

- Advertisement -