gpt4 book ai didi

mysql - mysql查询中的重复列名错误

转载 作者:行者123 更新时间:2023-11-29 01:17:30 26 4
gpt4 key购买 nike

如果从我的查询中得到重复列名的错误并且不知道如何解决我的查询是

SELECT distinct(courseid+senderid+recipientid) as diskey,
mess.id,
User.firstName as recipientName,
Course.name,
senderid,
recipientid,
courseid,
message,
mess.status,
mess.createdOn
FROM
(
SELECT *
from Message,User,Course
where Message.recipientid=User.id
and Message.courseid=Course.id
order by Message.createdOn DESC
) as mess,
User,
Course
WHERE senderid ='3'
OR recipientid='3'
GROUP BY diskey;

谁能帮上忙

最佳答案

为避免重复,在列名前加上其表的前缀,如下所示:

tab_name.col_name

关于mysql - mysql查询中的重复列名错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13343164/

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