可能還要留意會計科目變化
select activity_date, non_operating_income_ratio from
(
select activity_date, non_operating_income_ratio, max(report_date) from
(
select
A.activity_date,
A.number / B.number as non_operating_income_ratio,
A.report_date
from IncomeStmt as A
inner join
IncomeStmt as B
on A.stock_code = B.stock_code
and A.activity_date = B.activity_date
and A.item in ('營業外收入合計', '營業外收入及利益')
and B.item in ('繼續營業部門稅前淨利(淨損)', '繼續營業單位稅前淨利(淨損)')
and A.report_type = 'C'
and B.report_type = 'C'
and A.stock_code = '2002'
)
where non_operating_income_ratio is not null
group by activity_date
order by activity_date
)
沒有留言:
張貼留言