Files
mip/Schema/V_LACO.vw
hardya 01b5b4c979 Add V_LACO.vw - shows labour costs
git-svn-id: http://locode01.ad.dom/svn/WEBMIP/trunk@3149 248e525c-4dfb-0310-94bc-949c084e9493
2008-01-07 17:29:06 +00:00

30 lines
919 B
Plaintext

CREATE OR REPLACE VIEW V_LACO AS
SELECT enty_code
,mety_code
,svcpt_code
,mesc_code
,selling_price
,cost_price
,delivery_cost
,regi_code
,valid_from AS effective_from
,least(nvl(valid_to
,to_date('2099'
,'yyyy'))
,nvl(next_valid_from
,to_date('2099'
,'yyyy'))) AS effective_to
FROM (SELECT enty_code
,mety_code
,svcpt_code
,mesc_code
,selling_price
,cost_price
,delivery_cost
,regi_code
,valid_from
,valid_to
,lead(valid_from) over(PARTITION BY enty_code, mety_code, svcpt_code, mesc_code, regi_code ORDER BY valid_from) AS next_valid_from
FROM costs cost
WHERE cost_type = 'LACO');