checkouts
| item_id | user_id |
items
| item_id |
I want a query that will return ALL THE ITEMS with a column that if it exists in checkouts for a particular user_id, it returns a 1. Otherwise it will return a 0.
select *
from checkouts
right join items on items.item_id = checkouts.item_id
where checkouts.user_id = 10
The problem is that it only returns items that it joins on, not ALL the items.
Any ideas?
What about…