[新手請益] 關於sql的別名....

看板PHP作者 (少了果醬的吐司)時間19年前 (2007/01/25 12:26), 編輯推噓0(001)
留言1則, 1人參與, 最新討論串1/1
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
又或者是說,我該問的是巢狀的SQL怎麼寫?
01/25 15:53, 1F
文章代碼(AID): #15k35VG- (PHP)
文章代碼(AID): #15k35VG- (PHP)