开发者

Selecting a group of names

开发者 https://www.devze.com 2023-01-04 16:55 出处:网络
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.

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.开发者_StackOverflow社区.participants)

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


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消