Ok ... so I'm looking at a query where im trying to show a bunch of
columns counted up based on criteria ...
So far i've been able to count all the rows up and show them ... and
also count up one column based on the criteria (value = yes) ... but
not both at the same time ...
When i try it with all of them, all of them are either the same number
or no numbers at all ...
So to get all the rows i just do
SELECT count(col1), count(col2), count(col3) from table;
And that give me ALL the row count ...
So to get a single column with the correct criteria i do:
SELECT count(col1) from table where col1='yes';
And this gives me the correct number im looking for, but for only 1 row
I've tried this with both AND and OR's:
SELECT count(col1), count(col2), count(col3) from table where col1=yes
AND/OR col2 = yes AND/OR etc ...
AND gives me '0' and OR gives me '12' and the cols should be 3,2,2
respectively. I understand the logic behind these wrong numbers, i
just dont know the logic to get the correct numbers ...
.... any ideas?!