Converting bool to int in postgresql
I am trying to run the following SQL query.
SELECT
item.item_number, SUM(item.item_active)
FROM
public.item
GROUP BY item.item_number;
I am returning the following error:
ERROR: function sum(boolean) does not exist
I suppose if I can use a function to change item.item_active
to an integer then it can take the sum of active records.
+3
source to share
2 answers