Re: cross-reference of field names in query

2005-06-20 Thread mfatene

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 <[EMAIL PROTECTED]>:

> 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?
>
> Tom.
>
> --
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
>
>



-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



cross-reference of field names in query

2005-06-20 Thread Tom Cunningham
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?

Tom.

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]