I have table with columns type(0 or 1), amount(int)
I need query what returns 2 params: sum amount for type = 1 and sum amount for type = 0
2 queries:
SELECT SUM(amount) AS income FROM table WHERE type = 0;
SELECT SUM(amount) AS expense FROM table WHERE type = 1;
But can i return these params using only 1 query?
Demo