#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2000
    Posts
    1
    Rep Power
    0
    Being relatively new at this, I hope that this isn't too embarassing a question :-)...

    I have a table that stores the scores from a test that looks something like this;

    Student Date_taken Q1 Q2 Q3 ... Q78

    If the questions (Q%) are all true/false (ENUM('','T','F')), and I want to tally how many 'trues' a student recorded during a particular test, how can I write this select statment?

    If I need to know how many 'trues' the student answered for Q3, Q6, Q9, etc... on a particular test, how do I write a select statement for this?

    Thanks alot for any help...
    Matt
  2. #2
  3. No Profile Picture
    Robert_J_Sherman
    Guest
    Devshed Newbie (0 - 499 posts)
    IMHO, the simplest solution would be to tally them before you record them into the db, into their own column (like no_t, no_f).

    Then your query would be very quick and simple to perform. a quick for loop..

    ------------------
    SnR Graphics,
    Low Cost Hosting and Web Development.
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 1999
    Posts
    119
    Rep Power
    16
    I'm new at this too, but dbi returns the results in an array, array ref, and hash ref... you can just count the number of rows in the array, etc...

Similar Threads

  1. div style="overflow: scroll;"
    By slydero in forum HTML Programming
    Replies: 8
    Last Post: October 26th, 2004, 09:54 AM
  2. row not inserting at end of table
    By sweetpotatoe in forum PHP Development
    Replies: 9
    Last Post: December 15th, 2003, 01:07 PM
  3. <THEAD> not printing across multiple pages
    By allanmcc in forum HTML Programming
    Replies: 2
    Last Post: September 29th, 2003, 08:47 PM
  4. Creating An Excel Spreadsheet From Web Form Data
    By MGarde in forum ASP Programming
    Replies: 5
    Last Post: May 19th, 2003, 09:22 PM

IMN logo majestic logo threadwatch logo seochat tools logo