I want to do the following pseudo-SQL:
SUM( SELECT a FROM tab WHERE b > 0);
This syntax doesn't work (at least not in sqlite), so I'm trying to figure out the proper phrasing.
SELECT SUM(a) FROM tab WHERE b > 0 GROUP BY (*); % nope
SELECT SUM(a) FROM tab WHERE b > 0 GROUP BY (1); % nope
Suggestions?