From b675200690838883dfabb242f0e2cf3735ae97f3 Mon Sep 17 00:00:00 2001 From: Joseph Ferano Date: Tue, 14 Jun 2022 23:40:35 +0700 Subject: [PATCH] Do a full join --- Bot/DbService.fs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Bot/DbService.fs b/Bot/DbService.fs index dbfc027..04e5346 100644 --- a/Bot/DbService.fs +++ b/Bot/DbService.fs @@ -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; """