List:General Discussion« Previous MessageNext Message »
From:Daevid Vincent Date:April 6 2004 12:29am
Subject:Why can't I use an "AS" value in the WHERE clause.
View as plain text  
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;

It's so obnoxious, especially since I can do this:

SELECT *, IF(( (unix_timestamp()-unix_timestamp(last_seen)) < 600),1,0) as
active FROM wifi_table WHERE unix_timestamp()-unix_timestamp(last_seen) <
600;

Why do I have to do the math TWICE?!

*sigh*

Thread
Why can't I use an "AS" value in the WHERE clause.Daevid Vincent6 Apr
  • Re: Why can't I use an "AS" value in the WHERE clause.Paul DuBois6 Apr
    • Re: Why can't I use an "AS" value in the WHERE clause.Joe Rhett6 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 Stassen7 Apr
  • Re: Why can't I use an "AS" value in the WHERE clause.Matt W6 Apr
  • Re: Why can't I use an "AS" value in the WHERE clause.Adam7 Apr
    • Re: Why can't I use an "AS" value in the WHERE clause.Michael Stassen7 Apr
      • Re: Why can't I use an "AS" value in the WHERE clause.Adam8 Apr
        • Re: Why can't I use an "AS" value in the WHERE clause.Michael Stassen8 Apr
          • Re: Why can't I use an "AS" value in the WHERE clause.Adam10 Apr