I have the following MySQL tables:
tbl_pet_owners:
+----+--------+----------+--------+--------------+
| id | name | pet | city | date_adopted |
+----+--------+----------+--------+--------------+
| 1 | jane | cat | Boston | 2017-07-11 |
| 2 | jane | dog | Boston | 2017-07-11 |
| 3 | jane | cat | Boston | 2017-06-11 |
| 4 | jack | cat | Boston | 2016-07-11 |
| 5 | jim | snake | Boston | 2017-07-11 |
| 6 | jim | goldfish | Boston | 2017-07-11 |
| 7 | joseph | cat | NYC | 2016-07-11 |
| 8 | sam | cat | NYC | 2017-07-11 |
| 9 | drew | dog | NYC | 2016-07-11 |
| 10 | jack | frog | Boston | 2017-07-19 |
+----+--------+----------+--------+--------------+
tbl_pet_types:
+----------+-------------+
| pet | type |
+----------+-------------+
| cat | mammal |
| dog | mammal |
| goldfish | fish |
| goldfish | seacreature |
| snake | reptile |
+----------+-------------+
I have the following SELECT statement
SELECT DISTINCT owners.name, owners.pet, owners.city,
group_concat(DISTINCT types.type separator ', ') AS type
FROM tbl_pet_owners owners
INNER JOIN tbl_pet_types types ON owners.pet = types.pet
WHERE owners.city = 'Boston' OR owners.city = 'NYC'
GROUP BY owners.name, owners.pet
ORDER BY owners.city
..which returns this result:
+--------+----------+--------+-------------------+
| name | pet | city | type |
+--------+----------+--------+-------------------+
| jack | cat | Boston | mammal |
| jane | cat | Boston | mammal |
| jane | dog | Boston | mammal |
| jim | goldfish | Boston | fish, seacreature |
| jim | snake | Boston | reptile |
| drew | dog | NYC | mammal |
| joseph | cat | NYC | mammal |
| sam | cat | NYC | mammal |
+--------+----------+--------+-------------------+
Unfortunately, jack's frog is omitted from the results because there is no entry for frog in tbl_pet_types. How can I edit my query to include jack's frog in the results (with type = NULL)?

INNER JOINto aLEFT OUTER JOINand let 'er rip.INNER JOINsays "Only return results where the join condition is true".LEFT OUTER JOINsays "Return all results from the first table and only those results from the left-join'd table where the condition is true"WHEREclause also need to be moved to theONclause.ONclause would be an odd move in this case.