Generating Random Records Date Wise
Posted
by Julian
on Stack Overflow
See other posts from Stack Overflow
or by Julian
Published on 2010-06-13T05:00:20Z
Indexed on
2010/06/13
5:02 UTC
Read the original article
Hit count: 311
sql-server
|sql-server-2005
I work for a non-profit organization where we send volunteers to aided schools everyday. I am creating a site to display this info and am using SQL server express. I want some help regarding a query so here's my first post
We have 15 volunteers currently who will go to 4 different schools to teach. Here are some conditions:
- We have to create a 'new' group comprising of 1 Leader and 4 TeamSupporters 'every day' except Sunday who will go to teach everyday
- If a person becomes a Leader in a week, he cannot become a leader again for the same week.
- A leader can become a TeamSupporter in the same week.
- Moving ahead, we can have more number of school to target, so 4 is not a constant
Here's how the output should look like
School1 School2 School3 School4
Jun14 Leader V6 V6 V6 V6
Support1 V3 V3 V3 V3
Support2 V9 V9 V9 V9
Support3 V12 V12 V12 V12
Support4 V1 V1 V1 V1
Jun15 Leader V2 V2 V2 V2
Support1 V7 V7 V7 V7
Support2 V9 V9 V9 V9
Support3 V8 V8 V8 V8
Support4 V11 V11 V11 V11
Jun16 Leader V9 V9 V9 V9
Support1 V6 V6 V6 V6
Support2 V4 V4 V4 V4
Support3 V3 V3 V3 V3
Support4 V14 V14 V14 V14
and so on..
© Stack Overflow or respective owner