I'm new to MySQL (using SQLite) and working on a more complex query
Assume my database is something like
tablename = "stages"
id | results | stage | parent_id
1 | no | 'stage1' | 1
2 | no | 'stage1' | 1
3 | yes | 'stage1' | 2
4 | no | 'stage2' | 2
The query I'm trying to do is add a COUNT
column, counting the number of results
where stage = stage1
The desired results would be:
parent_id | stage | stage_no_count | stage_yes_count
How would I go about doing this?
EDIT: For all of the answers, THANK YOU! I was just trying to understand the logic that goes into a simple query like this. I can re-apply it to a more complex query, but was curious how I'd do it for a simple example.