SELECT posts.content, posts.title, owners.firstname,
owners.lastname, owners.email
FROM posts,owners JOIN posts ON posts.owner_id = owners.owner_id;
我试图从两个表中显示(内容,标题,名字,姓氏,电子邮件)(包含字段-owner_id,名字,姓氏,电子邮件和帖子的所有者包含字段-id,owner_id,内容,标题, CREATED_TIME,updated_time)。
显示,
'不是唯一的表/别名'错误。
这是什么解决方案?提前致谢。
答案 0 :(得分:1)
您的查询FROM
部分出错了。你是一个混合旧样式和ANSI样式JOIN
语法。它必须像
FROM posts JOIN owners ON posts.owner_id = owners.owner_id;
答案 1 :(得分:1)
SELECT posts.content, posts.title, owners.firstname, owners.lastname, owners.email
FROM owners
JOIN posts ON posts.owner_id = owners.owner_id;
答案 2 :(得分:0)
在FROM部分之后,您的查询似乎是错误的,正确的查询是:
SELECT posts.content, posts.title, owners.firstname, owners.lastname, owners.email FROM posts JOIN owners ON posts.owner_id = owners.owner_id;
您可以在link
中查看有关JOIN的更多信息