[新手請益] 關於sql的別名....
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)
→
01/25 15:53, , 1F
01/25 15:53, 1F
PHP 近期熱門文章
PTT數位生活區 即時熱門文章