select distinct jh.fiscal_year, chartfield1 as location, pd.project_id, pd.descr254 as project_descr, projcost.total_amount
from psf9_y.ps_jrnl_header jh, psf9_y.ps_jrnl_ln jl,
(
select project_id, descr254
from ps_project_descr
) pd,
(
select project_id, sum(foreign_amount) as total_amount
from psf9_y.ps_jrnl_ln
group by project_id
) projcost
where jl.project_id = pd.project_id
and jh.journal_date = jl.journal_date
and jh.business_unit = jl.business_unit
and jh.journal_id = jl.journal_id
and projcost.project_id = pd.project_id
and jl.project_id <> ' '
and jh.fiscal_year in ('2008', '2009', '2010', '2011')
and ( chartfield1 like 'NO%'
or chartfield1 like 'NC%'
or chartfield1 like 'SC%'
or chartfield1 like 'CC%'
or chartfield1 like 'JS%'
)
order by 1;