Hi all,
I have a table of football results which in its most basic form contains columns for team, date and result (Win,Lose). Can anyone suggest a way to find the longest run of wins/losses for any team in the table without using a cursor? The longest run should be limited to a single team but I want the longest run of wins/losses from all teams.
Thanks for your help!
Rick
Team Date WiLose
A 01/01/2010 Win
A 07/01/2010 Lose
A 13/01/2010 Lose
A 19/01/2010 Lose
A 25/01/2010 Lose
A 31/01/2010 Lose
A 06/02/2010 Win
A 12/02/2010 Lose
A 18/02/2010 Win
B 01/01/2010 Lose
B 07/01/2010 Win
B 13/01/2010 Lose
B 19/01/2010 Win
B 25/01/2010 Win
B 31/01/2010 Win
B 06/02/2010 Win
B 12/02/2010 Lose
B 18/02/2010 Lose
C 01/01/2010 Lose
C 07/01/2010 Lose
C 13/01/2010 Lose
C 19/01/2010 Lose
C 25/01/2010 Lose
C 31/01/2010 Win
C 06/02/2010 Win
C 12/02/2010 Lose
C 18/02/2010 Win
I have a table of football results which in its most basic form contains columns for team, date and result (Win,Lose). Can anyone suggest a way to find the longest run of wins/losses for any team in the table without using a cursor? The longest run should be limited to a single team but I want the longest run of wins/losses from all teams.
Thanks for your help!
Rick
Team Date WiLose
A 01/01/2010 Win
A 07/01/2010 Lose
A 13/01/2010 Lose
A 19/01/2010 Lose
A 25/01/2010 Lose
A 31/01/2010 Lose
A 06/02/2010 Win
A 12/02/2010 Lose
A 18/02/2010 Win
B 01/01/2010 Lose
B 07/01/2010 Win
B 13/01/2010 Lose
B 19/01/2010 Win
B 25/01/2010 Win
B 31/01/2010 Win
B 06/02/2010 Win
B 12/02/2010 Lose
B 18/02/2010 Lose
C 01/01/2010 Lose
C 07/01/2010 Lose
C 13/01/2010 Lose
C 19/01/2010 Lose
C 25/01/2010 Lose
C 31/01/2010 Win
C 06/02/2010 Win
C 12/02/2010 Lose
C 18/02/2010 Win