views:

55

answers:

1

I am struggling with a query in SQL Server 2005-2008

There are 15 participants in a tournament. Every day, 7 random participants are chosen. Out of the 7, one is the teamleader.

The condition is that if a person has become a teamleader once, he cannot become again till all the others (rest 14) have got their chances.

How can i write a query to list these participants, day wise for an entire month except sunday

Here's the way the output expected (assuming TL is the TeamLeader and P1, P2..participants)

           TL     P1      P2      P3      P4      P5      P6
Jun 23 -  
Jun 24 -  
Jun 25 -  
Jun 26 -  
Jun 28 -  
Jun 29 -  
and so on...
A: 

Maintain one table for the TL and create one table with All the participant and put one flag of team leader and put week No with Flag so you know that on this week that participants is team leader after all the participants flag is true then set as false to all and start again same process. Use Rand function to select the Random participants with some calculation.

KuldipMCA