I’m having some trouble with this one thing I’m working on in php(though I don’t think it matters much).
I’ve got a table called apples. It has a column called good apples that has values 0 or 1. I want to do an sql query that I want to use to display good apples=1 out of total apples in that table. How do I count ALL and good apples=1 in a single query, if that’s the way to do this?
try this:
select sum(good_apples) as good_count, count(*) as all_count from apples