List:General Discussion« Previous MessageNext Message »
From:Peter Brawley Date:October 22 2005 10:59pm
Subject:Re: help with query
View as plain text  

Your question is a little cryptic. If a questionid column value 
identifies a particular question, and a vote column value contains a 
user's vote (1,2,3, &c), can't you just write...

SELECT questionid, vote,count(vote)
FROM ...
GROUP BY questionid, vote



jabbott@stripped wrote:

>I have a table of votes with four fields, a primary key, and userID, that are just
> there for tracking purposes.  But then I have questionID and vote fields.  For each
> question, a user could pick a number of it's importance from 1 to 5.  That number is what
> gets stored in the vote field. 
>So, now I want to tabulate the votes.  I thought I could just do a count with a group
> by but that isn't working.  What I want to do is for each question, get a count of how
> many ones, how many twos, how many threes, etc.

No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.344 / Virus Database: 267.12.4/146 - Release Date: 10/21/2005

help with queryjabbott23 Oct
  • Re: help with querySGreen23 Oct
  • Re: help with queryPeter Brawley23 Oct