Re: Alias Error in a select statement

2003-03-26 Thread Paul DuBois
[EMAIL PROTECTED] writes:
 Description:
  Hello,

When I run the following query:
Select Can as MiCantidad, MiCantidad * 2 from Stocks limit 10

I get the following error:

'The column 'MiCantidad' in field list is unknown'
 
So, Can I reference to a column by its alias in a
select statement?   
Thanks in advance,
Rafa
 How-To-Repeat:
Select Can as MiCantidad, MiCantidad * 2 from stocks limit 10
Hi!

This is not  a bug.

You can not reference an alias in the select list.

You can do it freely in WHERE, ON , GROUP BY and other clauses.
Not quite...

Not in a WHERE clause.  Well, table aliases, yes; column aliases, no.

--
   __  ___ ___   __
  /  |/  /_ __/ __/ __ \/ /Mr. Sinisa Milivojevic <[EMAIL PROTECTED]>
 / /|_/ / // /\ \/ /_/ / /__   MySQL AB, Fulltime Developer
/_/  /_/\_, /___/\___\_\___/   Larnaca, Cyprus
   <___/   www.mysql.com


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


Re: Alias Error in a select statement

2003-03-26 Thread Sinisa Milivojevic
[EMAIL PROTECTED] writes:
> Description:
>  Hello,
> 
> 
>When I run the following query:
> 
>Select Can as MiCantidad, MiCantidad * 2 from Stocks limit 10
> 
>I get the following error:
> 
>'The column 'MiCantidad' in field list is unknown'
>  
>So, Can I reference to a column by its alias in a
>select statement?
> 
> 
>Thanks in advance,
>Rafa
> 
> How-To-Repeat:
>Select Can as MiCantidad, MiCantidad * 2 from stocks limit 10

Hi!

This is not  a bug.

You can not reference an alias in the select list. 

You can do it freely in WHERE, ON , GROUP BY and other clauses.

-- 
   __  ___ ___   __
  /  |/  /_ __/ __/ __ \/ /Mr. Sinisa Milivojevic <[EMAIL PROTECTED]>
 / /|_/ / // /\ \/ /_/ / /__   MySQL AB, Fulltime Developer
/_/  /_/\_, /___/\___\_\___/   Larnaca, Cyprus
   <___/   www.mysql.com



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