reusing alias in SELECT
EDIT: DOES NOT WORK. See comments.Isn't using a user variable faster in this case?
SELECT @dr:=SUM(b.bet_win * cy.fx_rate ), @cr:=SUM(b.bet_loss * cy.fx_rate ), @cr+@dr as total
EDIT: DOES NOT WORK. See comments.Isn't using a user variable faster in this case?
SELECT @dr:=SUM(b.bet_win * cy.fx_rate ), @cr:=SUM(b.bet_loss * cy.fx_rate ), @cr+@dr as total