From: ChrisC on
Tonkuma wrote:
> If you have some columns to relate a planned row with a fabbed row,
> you can use them for join condition.

If you have that column to join on, you can ignore the join
altogether. For instance, if you have a WEEK column that you are
reporting by, you could use:

SELECT WEEK, SUM(case when mytype = 8 then weekscum end) as fabbed,
SUM(case when mytype = 15 then weekscum end) as planned
FROM mytable
WHERE ccin_id = 1
AND plant_id = 1
GROUP BY WEEK