I have MySQL table as follow:
id | ads | status | user_id |
What would be best way to get:
- count of all rows
where user_id=1 and status=1
- count of all rows
where user_id=1 and status=0
- sum of all ads
where user_id=0
- sum of all ads
where user_id=1
My question: Can I run only one query to get all 4 results? If so, would you please explain how.
Thank you in advance.