Results 1 to 3 of 3
  1. #1
    Join Date
    Jan 2010
    Posts
    1

    Angry Unanswered: challenging query

    Dear All

    I've a table which stores values of people attending sports class in different locations in 7 days

    For e.g.

    Record ID | Location | Day
    ---------------------------------
    1 | LA | Day 1
    1 | LA | Day 2
    1 | LA | Day 3
    2 | BA | Day 1
    2 | BA | Day 4
    2 | BA | Day 7


    The above is just a sample I've records of 30,000 where people attend every day till Day 7 and some only attend Day 1 or Day

    3 etc...

    Now I want the following results

    The first question would be how many people attended every day? - I got this One (means all Day 1, Day 2, Day 3, Day 4,

    Day 5, Day 6, Day 7)

    second how many missed a day or more?
    (not able to get this one)

    third how many people attended for less than 3 days (can be any either Day 1, Day 2, Day 3, Day 4, Day 5, Day 6, Day 7)?
    (not able to get this one)

    fourth how many people attended only on Day 7?
    (not able to get this one)

    Any help would be really great!!!!!!!!

    Thanks a lot.

  2. #2
    Join Date
    Nov 2003
    Posts
    2,933
    Provided Answers: 12
    Quote Originally Posted by maskme View Post
    Any help would be really great!!!!!!!!
    Show us what you have so far and we'll be happy to correct/optimize your statements.

    Don't forget to include the error messages (copy & paste them) if you have syntax problems.
    If you are not getting the result you want, show us what the result is and point out the missing/wrong information.

    You will also get a lot more answers if you post the necessary CREATE TABLE statements and ideally some INSERT statements to populate the tables with sample data.

  3. #3
    Join Date
    Jun 2007
    Location
    London
    Posts
    2,527
    It might also be worth pointing out that it's homework.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •