Sunday, 29 December 2013

Query F.A.AA

select 
dp.period_name,
dp.fiscal_year,
dp.period_open_date,
dp.period_close_date,
bks.date_effective,
bks.date_ineffective,
bks.adjustment_required_status,
fab.asset_number,
fab.tag_number,
fat.description,
bks.date_placed_in_service,
cata.segment1,
cata.segment2,
cata.segment3,
fab.attribute1  Color,
fab.attribute2  Capacity,
fab.attribute3  EnginNo,
fab.attribute4  ChasisNo,
fab.serial_number,
fab.current_units,
bks.prorate_convention_code,
bks.deprn_method_code,
bks.life_in_months,
bks.cost,
ds.ytd_deprn       YTD,
ds.deprn_reserve   ACC_Deprn,
bks.cost-ds.deprn_reserve WVD
from
Fa_Additions_b fab,
Fa_Additions_Tl fat,
FA_Books        bks,
Fa_Categories_b cata,
Fa_Deprn_Summary  ds,
Fa_Deprn_Periods  dp
where
fab.asset_id=fat.asset_id       --relation link between  Fa_Additions_b fab and Fa_Additions_Tl fat,
and bks.asset_id=fab.asset_id   --relation link between  FA_Books bks and Fa_Additions_Tl fat
and cata.category_id=fab.asset_category_id --relation link between  Fa_Additions_b fab and Fa_Categories_b fab
and dp.period_counter=ds.period_counter --relation between Fa_Deprn_Summary  ds and Fa_Deprn_Periods  dp
and ds.asset_id=fab.asset_id            --relation betweeen Fa_Additions_b fab and Fa_Deprn_Summary  ds
and dp.period_name=&peridname--'NOV-14' --financial Period
and bks.adjustment_required_status='NONE'
--and fab.asset_number=21546
and cata.segment1=nvl(&MajorClassification,cata.segment1) --in(select distinct segment1 from Fa_Categories_b) --='OPR FA TAN FH'
and cata.segment2=nvl(&MajorCatagory,cata.segment2)-- in(select distinct segment2 from Fa_Categories_b)--='COMPUTER HARDWARE'--OR 'VEHICLES' --Major Category
and cata.segment3=nvl(&MinorCatagory,cata.segment3)-- in (select distinct segment3 from Fa_Categories_b)--'Note Books'       --OR'Motorcars' --Minor Category

No comments:

Post a Comment