List:General Discussion« Previous MessageNext Message »
From:Daevid Vincent Date:October 24 2007 1:26am
Subject:RE: Why can't I still not use an ALIAS in the SELECT portion of an SQL statement?
View as plain text  
Nope. I've only ever use mySQL. I only ever care to use mySQL. mySQL puts in
plenty of other features that no other RDBMS has or uses, and other RDBMS
have features that mySQL has, so what's the problem. Unless I was porting
to/from another RDBMS? It seems stupid that I can't do that though. I can
use the alias in the HAVING clause, and also in an ORDER BY clause. I'm not
saying it's a trivial change, I am saying that it would make a lot of sense
to do and I'm sure I'm not the first person to desire such a feature.

d

> -----Original Message-----
> From: Peter Brawley [mailto:peter.brawley@stripped] 
> Sent: Tuesday, October 23, 2007 5:39 PM
> To: Daevid Vincent
> Cc: mysql@stripped
> Subject: Re: Why can't I still not use an ALIAS in the SELECT 
> portion of an SQL statement?
> 
> >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)
> >
> >
> >   
> 
> -- 
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe:    
> http://lists.mysql.com/mysql?unsub=1
> 
> 

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