I have a query that works except I need to do a date evalution that takes any document that falls before the current period & puts it into the current period.
I'm stumped as to how add this case statement
case when P.po_promise < today then today else P.po_promise end
to the where clause so that the po_promise date is evaluted & assigned to the proper week. If I put this case statement in the listing of fields it works but can't figure out what the syntax is to put it in the where clause. I managed to get it to work fine in Access but the sql syntax from access isn't translating either so I'm stumped.
select PR.store,
P.po_id,
substring (I.inv_id2 from 1 for 1) as dept,
substring(I.inv_id2 from 2 for 3) as class,
end,
W.wx_week as week,
sum (PD.oocost) as CostOnOrder,
sum (PD.oortl) as RetailOnOrder
from
ren_poord_sum as PR join po as P on P.po_id=PR.poid
join ren_onorder_podollar as PD on PR.poid=PD.poid
and PR.item=PD.item and P.po_id=PD.poid
join inv as I on I.inv_id3=PD. item,
week as W join xcontrol as X on W. wx_year=X.comp_year
where P.po_promise between W.wx_begdate and W.wx_enddate
group by PR.store, 2,3,4,5,6
thanks
gina
I'm stumped as to how add this case statement
case when P.po_promise < today then today else P.po_promise end
to the where clause so that the po_promise date is evaluted & assigned to the proper week. If I put this case statement in the listing of fields it works but can't figure out what the syntax is to put it in the where clause. I managed to get it to work fine in Access but the sql syntax from access isn't translating either so I'm stumped.
select PR.store,
P.po_id,
substring (I.inv_id2 from 1 for 1) as dept,
substring(I.inv_id2 from 2 for 3) as class,
end,
W.wx_week as week,
sum (PD.oocost) as CostOnOrder,
sum (PD.oortl) as RetailOnOrder
from
ren_poord_sum as PR join po as P on P.po_id=PR.poid
join ren_onorder_podollar as PD on PR.poid=PD.poid
and PR.item=PD.item and P.po_id=PD.poid
join inv as I on I.inv_id3=PD. item,
week as W join xcontrol as X on W. wx_year=X.comp_year
where P.po_promise between W.wx_begdate and W.wx_enddate
group by PR.store, 2,3,4,5,6
thanks
gina