[PerlChina] 有个SQL 查询,出错了。着急问一下结果

Fayland Lam fayland at gmail.com
Wed Dec 3 22:44:22 PST 2008


rorot wrote:
> 不好意思,着急用。刚才在SQL IRC里没人回答。所以发这里,望有人解决一下。
>
> SELECT (unix_timestamp(now()) - unix_timestamp(starttime)) as diff
> FROM `workers` WHERE diff < 900;

sounds like you want HAVING. you can't use SELECT result to be a WHERE.
it's not logic sane.

>
> 上面这条MySQL查询为什么出错??
>
> *MySQL said: *Documentation
> <http://dev.mysql.com/doc/refman/5.0/en/error-messages-server.html>
>
> | #1054 - Unknown column 'diff' in 'where clause' |
>
>
>
> rorot Dec/04/2008
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> China-pm mailing list
> China-pm at pm.org
> http://mail.pm.org/mailman/listinfo/china-pm


-- 
Fayland Lam // http://www.fayland.org/ 
Foorum based on Catalyst // http://www.foorumbbs.com/ 



More information about the China-pm mailing list