gpt4 book ai didi

mysql - 显示连接数据库错误

转载 作者:行者123 更新时间:2023-11-30 23:02:07 25 4
gpt4 key购买 nike

CDbCommand 无法执行 SQL 语句:SQLSTATE[42S22]:未找到列:1054 ‘order 子句’中的未知列‘update_time’。

执行的SQL语句是:

SELECT `t`.`id` AS `t0_c0`, 
`t`.`title` AS `t0_c1`,
`t`.`content` AS `t0_c2`,
`t`.`status` AS `t0_c3`,
`t`.`tags` AS `t0_c4`,
`t`.` update_time` AS `t0_c5`,
`t`.`create_time` AS `t0_c6`,
`t`.`author_id` AS `t0_c7`
FROM `post` `t`
WHERE (status=2)
ORDER BY update_time DESC
LIMIT 10

最佳答案

尝试通过别名引用该列:

SELECT `t`.`id` AS `t0_c0`, 
`t`.`title` AS `t0_c1`,
`t`.`content` AS `t0_c2`,
`t`.`status` AS `t0_c3`,
`t`.`tags` AS `t0_c4`,
`t`.`update_time` AS `t0_c5`,
`t`.`create_time` AS `t0_c6`,
`t`.`author_id` AS `t0_c7`
FROM `post` `t`
WHERE (`t`.`status`=2)
ORDER BY `t`.`update_time` DESC
LIMIT 10

关于mysql - 显示连接数据库错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23536800/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com