MySQL Forums
Forum List  »  Performance

Re: Subset Query Speed Help from .46 second to 7 minutes!
Posted by: Brian Pilati
Date: August 15, 2005 03:21PM

Brian Pilati wrote:
> > , IF( gl.credit > 0 , gl.credit , - gl.debit ) AS amount
> > , COALESCE(invoiced_transfers.debit, prepayments.debit) as payment

I have one last question. I need to find the balance which is the amount - payment.

Of course, in my select statement I can say:

IF( gl.credit > 0 , gl.credit , - gl.debit ) -
COALESCE(invoiced_transfers.debit, prepayments.debit) as balance

but why can't

, IF( gl.credit > 0 , gl.credit , - gl.debit ) AS amount
, COALESCE(invoiced_transfers.debit, prepayments.debit) as payment
, amount - payment

work as variable?

Options: ReplyQuote




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.