sql - 内连接 PostgreSQL
问题描述
我正在尝试将两个表与此查询连接在一起
select comments.* ,username, title
from comments INNER JOIN users ON comments.user_id = users.user_id
INNER JOIN posts ON comments.post_id = posts.post_id;
返回的结果是column reference "username" is ambiguous
解决方案
列应该是形式table.column
选择评论。*,用户名,标题
应该
select comments.* ,YOUR_TABLE.username, YOUR_TABLE.title