I am getting this error, while using the script below, I have searched many threads in this site and Google, But I can not find the solution for my problem.
total_tons, as selected as the amount ct.tons (IF (amount (wr.tons) null, yoga (wr.tons), 0) is not) total_delivered, yoga ( ct.tons - IF (amount (Wrktons) null, yoga (Wrktons), 0) is not) as total_balance, yoga (not null IF (amount (Fktons_fixed), yoga (f .tons_fixed ), 0)) as total_fixed, yoga (IF (amount (Fktons_fixed) null, ct.tons not - Yoga (Fktons_fixed), 0)) as total_unfixed, average (amount (IF (f .tons_fixed * f.hedge_price is not null, f.tons_fixed * f.hedge_price, 0)) / IF (amount (f.tons_fixed), as null avg_contract_price amount (f.tons_fixed), 1) + ct.differential_fob) Not average Avg_market_pb as avg_market_pb, avg_market_pice (cb.current_basis) avg_market_bbb, avg_market_fob as avg_contract_fob_diff, avg (IF (mf.diff is not zero, mf.diff, 0)) as avg_market_fob , Average (ct.differential_fob - if the (mf.diff is not zero, mf.diff, 0)) as avg_diff_fob contract whistle left whistle.grad_id = gm.id at grade_ master gram m.contract_id = ct left to join the movement on .id meters wrare.world_receipt w wr.movement_id = mf.grade_id = GMT on f.contract_id = ct.id on contract_price_fixati join left daily_basis db on ct.terminal_month = db.id Left to join in on f m.id mf.grade_id = ct.grade_id left to join the left include grade_master GMT market_fob_diff MF Seedikaidi = ct.idpler_buyer_id ct.id by GROUP I think the problem may be the amount within the sum (average), because when the amount on the left is removed, the script worked. Please help me improve it!
thanks
Replace lines like this
sum (If (amount (wr.tons) is zero, zodiac (wr.tons), 0)) as total_decked to
COALESCE (SUM (Wr) COALESCE () returns the first return of its parameters, which is not zero.
No comments:
Post a Comment