Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
SELECT *
FROM users
LEFT JOIN posts ON posts.user_id = users.user_id
+---------+-------+---------+---------+
| user_id | name | post_id | user_id |
+---------+-------+---------+---------+
| 1 | Matt | 1 | 1 |
| 1 | Matt | 2 | 1 |
| 1 | Matt | 3 | 1 |
| 2 | Simon | 4 | 2 |
| 2 | Simon | 5 | 2 |
| 3 | Jen | NULL | NULL |
+---------+-------+---------+---------+
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment