[devtalk] Retrieving monthly counts for multiple choice answers from MySQL for charting

Ross Clutterbuck ross.clutterbuck at gmail.com
Mon Jan 10 22:28:27 GMT 2011


Hi Matt

Sorry, it's a single table:

id: INT (11) auto-increment
q1: INT(1)
q2: INT(1)
q3: INT(1)
q4: INT(1)
posted: DATE
comments: TEXT
subjects: TEXT
product_id: TINYTEXT

and everything goes into there. Was always nice and simple when I was 
just collecting some basic feedback, but I guess this won't do for the 
trend analysis I'm after. Don't worry about the text fields, they're 
just free text boxes for additional information.

What would you propose as a more viable/correct database structure?

Ross



On 10/01/2011 22:17, Matt Wallace wrote:
> That should of course be answers, not anders.
>
> Bloody auto correct.
>
> M
>
> Matt Wallace<matthew at truthisfreedom.org.uk>  wrote:
>
>> Hey! :)
>>
>> Assuming you have a table called "answers" linked to a table called questions on a field named questionId then the following should work:
>>
>> Select count(answerId) from anders where questionId = $questionId
>>
>> Hth,
>>
>> Matt
> _______________________________________________
> devtalk mailing list
> devtalk at lists.preshweb.co.uk
> http://lists.preshweb.co.uk/mailman/listinfo/devtalk
>



More information about the devtalk mailing list