2008/12/4 smallfish <smallfish@live.cn>
只能用
SELECT (unix_timestamp(now()) - unix_timestamp(starttime)) as diff FROM `workers` WHERE (unix_timestamp(now()) - unix_timestamp(starttime)) < 900;
where里是不能用前面as的名字
--------------------------------------------------
From: "Fayland Lam" <fayland@gmail.com>
Sent: Thursday, December 04, 2008 2:44 PM
To: <china-pm@pm.org>
Subject: Re: [PerlChina] 有个SQL 查询,出错了。着急问一下结果
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@pm.org
http://mail.pm.org/mailman/listinfo/china-pm
--
Fayland Lam // http://www.fayland.org/
Foorum based on Catalyst // http://www.foorumbbs.com/
_______________________________________________
China-pm mailing list
China-pm@pm.org
http://mail.pm.org/mailman/listinfo/china-pm
_______________________________________________
China-pm mailing list
China-pm@pm.org
http://mail.pm.org/mailman/listinfo/china-pm
没有评论:
发表评论