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.



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*


--
Paul DuBois, MySQL Documentation Team
Madison, Wisconsin, USA
MySQL AB, www.mysql.com

MySQL Users Conference: April 14-16, 2004
http://www.mysql.com/uc2004/

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]



Reply via email to