Click to See Complete Forum and Search --> : count rows which has certain values


ketanco
10-06-2008, 12:13 PM
when I want the number of rows that has a certain idpoll AND has a certain response, I could not do the syntax. I did these both, and they give error:
$query="select count(1) FROM answers1 WHERE (idpoll='$idpoll', response='answer7')";
or this one gives error too:
$query="select count(1) FROM answers1 WHERE idpoll='$idpoll' AND WHERE response='answer7' ";

response and idpoll are two columns in my table...

what is the correct syntax please?

scragar
10-06-2008, 12:34 PM
...
WHERE idpoll='$idpoll' AND response='answer7'