Do a full join

This commit is contained in:
Joseph Ferano 2022-06-14 23:40:35 +07:00
parent ba5927cc52
commit b675200690

View File

@ -157,7 +157,7 @@ WITH raffles AS
JOIN item i on store_item.item_id = i.id
WHERE store_id = @sid AND store_item.unlisted = false)
SELECT * FROM raffles
INNER JOIN (SELECT item_id, count(*) AS total FROM inventory_item
FULL JOIN (SELECT item_id, count(*) AS total FROM inventory_item
WHERE item_id = ANY (SELECT raffle_id FROM raffles)
GROUP BY item_id) total_raffles ON total_raffles.item_id = raffle_id;
"""