I am trying to get the following query to group on the acctcode field. This is to show budget detail with a column for each month grouped by account. The month indicator (line_id) is the problem,
SELECT t0.acctcode,
(case when (t0.line_id) = 0 then sum(t0.debltotal) end) as January,
(case when (t0.line_id) = 1 then sum(t0.debltotal) end) as February,
(case when (t0.line_id) = 2 then sum(t0.debltotal) end) as March
from bgt1 t0 inner join OBGT t1 on T0.budgid = t1.absid
where t1.instance = '[%0]'
group by t0.line_id, t0.acctcode
How can I eliminate t0.line_id in the group by clause? Leaving it out of course creates an error.
Thanks