| List: | General Discussion | « Previous MessageNext Message » | |
| From: | Joe Rhett | Date: | April 6 2004 1:59am |
| Subject: | Re: Why can't I use an "AS" value in the WHERE clause. | ||
| View as plain text | |||
On Mon, Apr 05, 2004 at 08:03:33PM -0500, Paul DuBois wrote: > At 17:29 -0700 4/5/04, Daevid Vincent wrote: > >I'm curious when will I be able to do something like this: > > > >SELECT *, IF(( (unix_timestamp()-unix_timestamp(last_seen)) < 600),1,0) as > >active FROM wifi_table WHERE active = 1; > > I think you'll never be able to do it. > > The stuff after the SELECT is calculated based on the rows selected > by the WHERE. The WHERE therefore cannot be based on the stuff after > the SELECT. So why not the reverse? Allow aliasing in the WHERE clause, that we can use in the select clause. Probably not ANSI, but MySQL isn't shy about that. -- Joe Rhett Chief Geek JRhett@stripped Isite Services, Inc.
| Thread | ||
|---|---|---|
| • Why can't I use an "AS" value in the WHERE clause. | Daevid Vincent | 6 Apr |
| • Re: Why can't I use an "AS" value in the WHERE clause. | Paul DuBois | 6 Apr |
| • Re: Why can't I use an "AS" value in the WHERE clause. | Joe Rhett | 6 Apr |
| • Re: Why can't I use an "AS" value in the WHERE clause. | (Pete Harlan) | 6 Apr |
| • Re: Why can't I use an "AS" value in the WHERE clause. | Michael Stassen | 7 Apr |
| • Re: Why can't I use an "AS" value in the WHERE clause. | Matt W | 6 Apr |
| • Re: Why can't I use an "AS" value in the WHERE clause. | Adam | 7 Apr |
| • Re: Why can't I use an "AS" value in the WHERE clause. | Michael Stassen | 7 Apr |
| • Re: Why can't I use an "AS" value in the WHERE clause. | Adam | 8 Apr |
| • Re: Why can't I use an "AS" value in the WHERE clause. | Michael Stassen | 8 Apr |
| • Re: Why can't I use an "AS" value in the WHERE clause. | Adam | 10 Apr |
