Hi,

> So, where do you want OR and where do you want AND?

Your posting gave me an idea.  The following query give the correct answers 
(the one in my previous posting does not).
With Recursive
RecurseCGS as
(
 Select ID from CGS_Structure
   where ID = :ID_RootCGS
 Union all
 Select Child.ID from CGS_Structure Child, RecurseCGS Parent
   where Child.Parent_ID = Parent.id
)
select p.ID, p.BIZTYPE_DESCRIPTION, p.CostingType_Description, p.Description, 
p.CGS_Description, p.Date_Closing,
p.TOTAL_REVENUE, p.EXCHANGE_RATE, p.CGSSHARE_PCT from V_BD_Biz_Prim p, 
RecurseCGS
where (p.BIZTYPE_ID = :BizType_ID and p.CGS_ID = RecurseCGS.ID)
  and (p.date_closing is null
  or  (p.date_closing between :DateA and :DateB
  and coalesce(p.total_revenue,0) * coalesce(p.exchange_rate,0) * 
coalesce(p.cgsshare_pct,0) = 0))
order by p.BizType_Description, p.CGS_Description, p.Date_Closing desc, p.ID


Regards,

Nols Smit


[Non-text portions of this message have been removed]

Reply via email to