View Single Post

   
  #2 (permalink)  
Old 02-28-2008, 08:12 AM
PleegWat
 
Posts: n/a
Default Re: Count equals to ..?

In article <eeqcqm$hhu$1@daniel-new.mch.sbs.de>, Dennis Kuntzemann
says...
> Hello,
>
> I have a table from which a chart should be generated. there is one column
> that can have a value between 0-5. Now I want to run a query for column xy
> which counts the amount of zeros, ones, twos,...
> How can I build the query that it is known before that 6 results will be
> given back?
> If I make something like this:
> SELECT count(*) FROM cbc_survey c group by xy my chart does not know the
> amount of columns.
>
> I tried SELECT count(xy=1),count(xy=2),... FROM cbc_survey c but did not
> work.
> Any ideas?
>
> Thank u very much!
>
> Best regards,
>
> Dennis


SELECT foo, count(*)
FROM table
GROUP BY foo;

where foo is the 0-5 column

--
PleegWat
Remove caps to reply
Reply With Quote