I have a query:
SELECT id, SUM(col1), SUM(col2) FROM mytable WHERE condition1 = true
GROUP BY id;
This gives me 3 columns, but what I want is 5 columns where the next
two columns -- SUM(col3), SUM(col4) -- have a slightly different
WHERE clause, i.e., WHERE
On Sat, Oct 27, 2012 at 6:01 PM, Mark Fenbers mark.fenb...@noaa.gov wrote:
I have a query:
SELECT id, SUM(col1), SUM(col2) FROM mytable WHERE condition1 = true GROUP
BY id;
This gives me 3 columns, but what I want is 5 columns where the next two
columns -- SUM(col3), SUM(col4) -- have a
I'd do somethings like:
select * from (
select id, sum(col1), sum(col2) from tablename group by yada
) as a [full, left, right, outer] join (
select id, sum(col3), sum(col4) from tablename group by bada
) as b
on (a.id=b.id);
and choose the join type as
On Sat, Oct 27, 2012 at 7:56 PM, Mark Fenbers mark.fenb...@noaa.gov wrote:
I'd do somethings like:
select * from (
select id, sum(col1), sum(col2) from tablename group by yada
) as a [full, left, right, outer] join (
select id, sum(col3), sum(col4) from tablename group by bada