Hi,
SELECT @RES=data*2 AS intermediate_result,
@RES + 1 AS final_result
FROM table;
can do the trick.
Why not your method ? because it's v4.1
Mathias
Selon Tom Cunningham <tom....@gmail.com>:
Here's something I've been curious about:
Referring to one field from another field in a 'select' query:
SELECT data*2 AS intermediate_result,
intermediate_result + 1 AS final_result
FROM table;
I know that MySql 4.1 can't handle it, but:
(a) Is it part of standard SQL? (I have an example from a Joe Celko
book that seems to do it)
(b) If yes, then why not MySql? If no, then is there a simple reason
why it's not sensible?