Hi people...
given the following query:
if i only have one cost table instance in there (cfb, for example), it works fine. however, when I add a second and third, the totals are higher.
what concept am i missing? can i NOT have all that join mumbo jumbo in there?
thanks!
Cory
*cLFlaVA
----------------------------
[tt]I already made like infinity of those at scout camp...[/tt]
beware of active imagination: [URL unfurl="true"]http://www.coryarthus.com/[/url]
BillyRayPreachersSonIsTheLeetestHax0rDude
![[banghead] [banghead] [banghead]](/data/assets/smilies/banghead.gif)
given the following query:
Code:
select sp.sub_id as project_id
, cd_bu.code_short_descr as bus_unit
, cd_pg.code_short_descr as program_group
, pr.program_name as program
, sp.sub_name as project_name
, sum( cfb.cost_amount ) as fiscal_budget
, sum( cob.cost_amount ) as operating_budget
from sub_project sp join code_decode cd_bu on sp.sub_bu_cd = cd_bu.code and cd_bu.category_id = 2
join code_decode cd_pg on sp.sub_prg_grp_cd = cd_pg.code and cd_pg.category_id = 19
join program pr on sp.program_id = pr.program_id
left join cost cfb on sp.sub_id = cfb.sub_id and cfb.cost_budget_year = 2005 and cfb.cost_type_cd = 67 and cfb.cost_active_ind = 1 and cfb.cost_orig_ind = 0
left join cost cob on sp.sub_id = cob.sub_id and cob.cost_budget_year = 2005 and cob.cost_type_cd = 67 and cob.cost_active_ind = 1 and cob.cost_orig_ind = 1
where sp.sub_id in (105)
group by sp.sub_id
, cd_bu.code_short_descr
, cd_pg.code_short_descr
, pr.program_name
, sp.sub_name
if i only have one cost table instance in there (cfb, for example), it works fine. however, when I add a second and third, the totals are higher.
what concept am i missing? can i NOT have all that join mumbo jumbo in there?
thanks!
Cory
*cLFlaVA
----------------------------
[tt]I already made like infinity of those at scout camp...[/tt]
beware of active imagination: [URL unfurl="true"]http://www.coryarthus.com/[/url]
BillyRayPreachersSonIsTheLeetestHax0rDude
![[banghead] [banghead] [banghead]](/data/assets/smilies/banghead.gif)