クエリを書き直すより効率的な方法を見つけようとしています。
助言がありますか?現在、会計月名を数値そのものとして表示し、比較して月名を返すことも考えています。
(case --proj_end_fis_mon
when (MYMW.mfg_year_no = FYQM.fiscal_year_no and MYMW.mfg_month_no = 12)
then
(convert(varchar,(MYMW.mfg_year_no-1))+'-'+(case
when FM.fiscal_month_name like 'Jan%' then '01'
when FM.fiscal_month_name like 'Feb%' then '02'
when FM.fiscal_month_name like 'Mar%' then '03'
when FM.fiscal_month_name like 'Apr%' then '04'
when FM.fiscal_month_name like 'May' then '05'
when FM.fiscal_month_name like 'June' then '06'
when FM.fiscal_month_name like 'July' then '07'
when FM.fiscal_month_name like 'Aug%' then '08'
when FM.fiscal_month_name like 'Sep%' then '09'
when FM.fiscal_month_name like 'Oct%' then '10'
when FM.fiscal_month_name like 'Nov%' then '11'
when FM.fiscal_month_name like 'Dec%' then '12'
end))
else
(convert(varchar,MYMW.mfg_year_no)+'-'+(case
when FM.fiscal_month_name like 'Jan%' then '01'
when FM.fiscal_month_name like 'Feb%' then '02'
when FM.fiscal_month_name like 'Mar%' then '03'
when FM.fiscal_month_name like 'Apr%' then '04'
when FM.fiscal_month_name like 'May' then '05'
when FM.fiscal_month_name like 'June' then '06'
when FM.fiscal_month_name like 'July' then '07'
when FM.fiscal_month_name like 'Aug%' then '08'
when FM.fiscal_month_name like 'Sep%' then '09'
when FM.fiscal_month_name like 'Oct%' then '10'
when FM.fiscal_month_name like 'Nov%' then '11'
when FM.fiscal_month_name like 'Dec%' then '12'
end))
end)
これは私のテーブルがどのように見えるかです: