List:General Discussion« Previous MessageNext Message »
From:Peter Brawley Date:October 24 2007 12:39am
Subject:Re: Why can't I still not use an ALIAS in the SELECT portion of an
SQL statement?
View as plain text  
>When will I be able to do something seemingly 
>so basic as this re-use of an alias?

Do you know an implementation of SQL which allows this?

PB

Daevid Vincent wrote:
> When will I be able to do something seemingly so basic as this re-use of an
> alias?
>
> SELECT DATE_ADD('2007-10-23', INTERVAL user_access_hours HOUR) 
> 		AS group_duration_date,
> 	 UNIX_TIMESTAMP(group_duration_date)
> 		AS group_duration_date_timestamp
> FROM 	 end_user_groups;
>
> Error Code : 1054
> Unknown column 'group_duration_date' in 'field list'
> (0 ms taken)
>
> So instead I must do this very cumbersome and inefficient way:
>
> SELECT DATE_ADD('2007-10-23', INTERVAL user_access_hours HOUR) 
> 		AS group_duration_date,
> 	 UNIX_TIMESTAMP(DATE_ADD('2007-10-23', 
> 					INTERVAL user_access_hours HOUR)) 
> 		AS group_duration_date_timestamp
> FROM 	 end_user_groups;
>
> *sigh*
>
> This has been a cause of frustration since mysql 3.x series. 
> Are there any plans to fix this annoyance? If so, in what version?
>
> Currently using: 
> mysql  Ver 14.12 Distrib 5.0.41, for pc-linux-gnu (i686)
>
>
>   
Thread
Why can't I still not use an ALIAS in the SELECT portion of an SQL statement?Daevid Vincent23 Oct
  • Re: Why can't I still not use an ALIAS in the SELECT portion of anSQL statement?Peter Brawley24 Oct
    • RE: Why can't I still not use an ALIAS in the SELECT portion of an SQL statement?Daevid Vincent24 Oct
      • Re: Why can't I still not use an ALIAS in the SELECT portion of anSQL statement?mysql24 Oct
        • Re: Why can't I still not use an ALIAS in the SELECT portion of anSQL statement?mysql24 Oct