Wasn't sure how to word my question, so sorry if it's a little confusing. Hopefully the below will clear it up a bit.
Here's the query I'm running so far:
select business.name, ifnull(sum(checkin.count),0) as checknum from checkin inner join business on business.id = checkin.business_id where business.state = 'NY' group by business.name order by checknum desc;
and it almost works as intended. There is one more business in NY, which doesn't have any counts in the checkin table, but I can't get it to output.
This is my current output:
+---------------------------------------+----------+
| name | checknum |
+---------------------------------------+----------+
| Lakeside Coffee | 31 |
| McDonalds | 18 |
| Valero | 15 |
| Angelo's Pizza & Grill | 13 |
| Gino's Pizza | 8 |
| Sandy's Deli | 7 |
| Tribeca North Luxury Apartments Homes | 2 |
| Matt & Nat | 2 |
| Filion's Diner | 2 |
| Squirrel's Nest Restaurant and Bar | 2 |
| Best Friends Family Diner | 1 |
| China Buffet | 1 |
| Sandi's Kountry Kitchen | 1 |
| Dick's Country Store | 1 |
+---------------------------------------+----------+
But I need to capture the last business that doesn't have any checkins. Not sure how to tackle this further.