SQLSTATE[42000]: Syntax error or access violation: 1066 Not unique table/alias:
来源:8-13 完成Theme简要信息接口
武庚_Rehan
2018-05-04
应该是和这个地方的模型关联有关系,网上都是说SQL语句中,join同一张表时使用了相同的别名,我查看了下sql语句,确实是这样,但是tp5中应该如何修改呢?对照了源码差别不大啊,希望知道的可以解答下?很是感谢
SELECT
theme.id,
theme. NAME,
theme.description,
theme.topic_img_id,
theme.delete_time,
theme.head_img_id,
theme.update_time,
image.id AS topicImg__id,
image.url AS topicImg__url,
image.from AS topicImg__from,
image.delete_time AS topicImg__delete_time,
image.update_time AS topicImg__update_time,
image.id AS headImg__id,
image.url AS headImg__url,
image.from
AS headImg__from,
image.delete_time AS headImg__delete_time,
image.update_time AS headImg__update_time
FROM
theme theme
INNER JOIN image image ON theme.topic_img_id = image.id
INNER JOIN image image ON theme.head_img_id = image.id
WHERE
theme.id IN ('1', '2', '3')
1回答
-
武庚_Rehan
提问者
2018-05-04
问题已解决,是因为我通过copy的方法安装的tp5核心框架代码版本的问题,替换成了源码中的代码,就ok了
012018-05-05
相似问题