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)
 New to TSQL

Author  Topic 

Fischecp
Starting Member

2 Posts

Posted - 2007-12-11 : 21:24:19
Hey everyone,

I have been working on a football database and I think I have the whole database finished and now I am just trying to work on the TSQL to link it to the front-end.

Just a very brief background. I have a football game I am trying to impliment for next year for various friends and family some of which are overseas and in the military. I just wanted to make a football game they can check once a week and submit their "picks"

Anyway, my problem comes in a table in my database where I have a NFL Schedule where Team1 Plays Team2. I have 5 columns in that table. ScheduleID, WeekNum, Team1, Team2, and GameTime. Team1 and Team2 are FK's to the Teams Table with the TeamNames.

I would like to set it up so that I can pull 2 teams for each match and display the information like such in a table with approximately 16 rows for each NFL game.

Team1 vs Team2 [Drop Down Box w/2 Team Options] [Text Input Box for Rank]

They see who is playing, make their selection in the drop down box and then put their Rank for each match and submit their 16 picks. The problem is how in the world can you do a Select statement or anything to just get 2 results per drop down box? I am very new to TSQL and I realize that the ScheduleID is unique but I don't want to have to go in each week and change anything. All I want to do is change the week number and bam, everything updates since the schedule is already programmed in there. I can make a select statement to get the 32 teams but then how would you seperate those into just 2 teams for the first drop down, 2 teams for the 2nd drop down, etc?


Any Ideas?
Thanks, You guys are great,
Chris
   

- Advertisement -