2 messages in com.mysql.lists.mysqlRe: cross-reference of field names in...
FromSent OnAttachments
Tom Cunningham20 Jun 2005 10:03 
mfat...@free.fr20 Jun 2005 10:18 
Subject:Re: cross-reference of field names in query
From:mfat...@free.fr (mfat@free.fr)
Date:06/20/2005 10:18:21 AM
List:com.mysql.lists.mysql

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?