作者dinson520 (少了果酱的吐司)
看板PHP
标题[新手请益] 关於sql的别名....
时间Thu Jan 25 12:26:06 2007
select id, from_unixtime(mdl_log.time)as"to_FormalTime"
from mdl_log
where from_unixtime(mdl_log.time) between
"2007-01-15-00-00-00" and "2007-01-22-00-00-00"
----------------------------------------------------上述结果正确
上述的where条件中并非使用别名to_FormalTime,但我想使用
to_FormalTime作为别名,变成像下面的sql...,但确出现错误。
select id, from_unixtime(mdl_log.time)as"to_FormalTime"
from mdl_log
where to_FormalTime between
"2007-01-15-00-00-00" and "2007-01-22-00-00-00"
----------------------------------------------------上述结果有误
mysql错误讯息,#1054 - Unknown column 'to_FormalTime' in 'where clause'
请问(1).为什麽别名会不认得?
(2).如何修改?
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 125.232.1.212
※ 编辑: dinson520 来自: 125.232.1.212 (01/25 15:40)
1F:→ dinson520:又或者是说,我该问的是巢状的SQL怎麽写? 01/25 15:53