views:

14

answers:

0

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:

  1. We have to create a 'new' group comprising of 1 Leader and 4 TeamSupporters 'every day' except Sunday who will go to teach everyday
  2. If a person becomes a Leader in a week, he cannot become a leader again for the same week.
  3. A leader can become a TeamSupporter in the same week.
  4. 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..