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? List-Archive: http://lists.mysql.com/mysql/209648 Message-Id: <471E9434.30004@earthlink.net> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit >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) > > >