MySQL Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesMySQL Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now!
  #1  
Old June 19th, 2000, 11:02 AM
charlet charlet is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2000
Posts: 1 charlet User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation 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

Reply With Quote
  #2  
Old June 20th, 2000, 01:26 AM
Robert_J_Sherman
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
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.

Reply With Quote
  #3  
Old June 26th, 2000, 03:38 PM
ryanh ryanh is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 1999
Posts: 119 ryanh User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 m 41 sec
Reputation Power: 9
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...

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesMySQL Help > Counting across a row...


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway