この MySQL クエリを実行すると、次のエラーが発生します。私の問題はどこですか?
#1064
- SQL 構文にエラーがあります。19 行目の 'INT) LIMIT 0, 30' 付近で使用する正しい構文については、MySQL サーバーのバージョンに対応するマニュアルを確認してください。
select tran_date, tran_id,
sum(case account_id when 'M0003' then (cr_amt) else 0 end) as cr_sm,
sum(case account_id when 'M0003' then (dr_amt) else 0 end) as dr_sm,
sum(case account_id when 'M0003' then (balance) else 0 end) as bal_sm,
sum(case account_id when 'MD001' then (cr_amt) else 0 end) as cr_cdnw,
sum(case account_id when 'MD001' then (dr_amt) else 0 end) as dr_cdnw,
sum(case account_id when 'MD001' then (balance) else 0 end) as bal_cdnw,
sum(case account_id when 'MD002' then (cr_amt) else 0 end) as cr_cdw,
sum(case account_id when 'MD002' then (dr_amt) else 0 end) as dr_cdw,
sum(case account_id when 'MD002' then (balance) else 0 end) as bal_cdw,
sum(case account_id when 'ML001' then (cr_amt) else 0 end) as cr_loan_ord,
sum(case account_id when 'ML001' then (dr_amt) else 0 end) as dr_loan_ord,
sum(case account_id when 'ML001' then (balance) else 0 end) as bal_loan_ord,
sum(case account_id when 'ML002' then (cr_amt) else 0 end) as cr_loan_emg,
sum(case account_id when 'ML002' then (dr_amt) else 0 end) as dr_loan_emg,
sum(case account_id when 'ML002' then (balance) else 0 end) as bal_loan_emg
from TEMP_MEMBER_STATEMENT
group by tran_date, tran_id
order by tran_date, cast(tran_id as INT);