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.
| Author |
Topic |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2000-11-21 : 22:32:06
|
Tim writes "I am making a database to record results of matches played at my tennis club. Simple 3-table database design is this:
Player - Player_ID - Name
Match - Match_ID - Date
Result - Result_ID - Match_ID - Player_ID - Won - Lost - Draw
Won, Lost and Draw columns can have values of 1 or 0 and there would be two result records for each match played.
It is pretty easy to generate a list of players and total matches won, lost and drawn.
I am stuck on the 'streak' query which shows each player and their current streak as follows:
if player won last 4 consecutive matches then streak = 4 if player lost last 2 consecutive matches then streak = -2 if player drew last match played then streak = 0
Any ideas? a tweak to the design for this or just some clever SQL ?" |
|
|
|
|
|