0
是否有任何理由爲什麼MySQL不喜歡我的where子句中的下列顯式引用。MySQL明確引用table.column在哪裏條款
where [table]。[column]?
我得到一個錯誤查詢無效:未知列在「plugin_thold_log.id「where子句」
這部作品在TSQL。
'plugin_thold_log是我的數據庫中的一個表,id顯然是同一個表中的一列。
我的全部查詢:
這裏是我完整的查詢:
select pl.id as id,
from_unixtime(pl.time) as time,
case
when TIMESTAMPDIFF(MINUTE,(select from_unixtime(a.time) from plugin_thold_log a where a.id < plugin_thold_log.id and a.time >= '$dateStart' and a.time <= '$dateEnd' order by a.id desc LIMIT 1),from_unixtime(pl.time)) is null then 1
when TIMESTAMPDIFF(MINUTE,(select from_unixtime(a.time) from plugin_thold_log a where a.id < plugin_thold_log.id and a.time >= '$dateStart' and a.time <= '$dateEnd' order by a.id desc LIMIT 1),from_unixtime(pl.time)) > 30 then 1
when TIMESTAMPDIFF(MINUTE,(select from_unixtime(a.time) from plugin_thold_log a where a.id < plugin_thold_log.id and a.time >= '$dateStart' and a.time <= '$dateEnd' order by a.id desc LIMIT 1),from_unixtime(pl.time)) < 30
and TIMESTAMPDIFF(MINUTE,(select from_unixtime(a.time) from (select from_unixtime(a.time) from plugin_thold_log a where a.id < plugin_thold_log.id and a.time >= '$dateStart' and a.time <= '$datEend' order by a.id desc LIMIT 7) a order by 1 asc LIMIT 1),from_unixtime(pl.time)) < 30 then 0
when TIMESTAMPDIFF(MINUTE,(select from_unixtime(a.time) from plugin_thold_log a where a.id < plugin_thold_log.id and a.time >= '$dateStart' and a.time <= '$dateEnd' order by a.id desc LIMIT 1),from_unixtime(pl.time)) < 30
and TIMESTAMPDIFF(MINUTE,(select from_unixtime(a.time) from (select from_unixtime(a.time) from plugin_thold_log a where a.id < plugin_thold_log.id and a.time >= '$dateStart' and a.time <= '$datEend' order by a.id desc LIMIT 7) a order by 1 asc LIMIT 1),from_unixtime(pl.time)) is null then 0
else 1
end
from
plugin_thold_log pl
where
pl.time >= '$dateStart'
and pl.time <= '$dateEnd'
order by 1
加了我完整的查詢 –
@AndrewBurns:回答更新,你可能會有幫助。 – wchiquito
謝謝wchiquito仍然得到相同的未知列錯誤:( –