MySQL Forums
Forum List  »  Stored Procedures

Re: Case Statement Bug/Syntax error
Posted by: maitrik panchal
Date: February 19, 2012 08:46PM

Thanks Peter,

it worked very well for me.

But one more issue is there with this code. Following query is not giving proper output.

..
@amntd:=sum( if(crdr = 'D',amnt,0) ) `amntd`,
@amntc:=sum( if(crdr = 'C',amnt,0) ) `amntc`,
@amntn:= @amntd - @amntc `amntn`
..

Here, amntN column populates null values.
So I have to write outer query to subtract amntc from amntd but it makes query lengthier then what is required.
Could you please provide a best solution for this case?

Options: ReplyQuote


Subject
Views
Written By
Posted
2281
February 17, 2012 03:44AM
995
February 17, 2012 10:42AM
Re: Case Statement Bug/Syntax error
1144
February 19, 2012 08:46PM
871
February 20, 2012 11:21AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.