diff --git a/src/mtgcoll/views/functions/sets.clj b/src/mtgcoll/views/functions/sets.clj index fff210f..2051edf 100644 --- a/src/mtgcoll/views/functions/sets.clj +++ b/src/mtgcoll/views/functions/sets.clj @@ -15,10 +15,11 @@ where c.set_code = s.code ) as card_count, ( - select count(*) + select count(distinct c.id) from collection cl join cards c on cl.card_id = c.id - where c.set_code = s.code and cl.quantity > 0 and cl.list_id = 0 + where c.set_code = s.code + and cl.quantity > 0 and cl.list_id = 0 ) as owned_count from sets s where s.code = ?" code]) @@ -44,9 +45,10 @@ where c.set_code = s.code ) as card_count, ( - select count(*) + select count(distinct c.id) from collection cl join cards c on cl.card_id = c.id - where c.set_code = s.code and cl.quantity > 0 and cl.list_id = 0 + where c.set_code = s.code + and cl.quantity > 0 and cl.list_id = 0 ) as owned_count from sets s"])