Postgresql列引用“ id”模棱两可 [英] Postgresql column reference "id" is ambiguous

查看:83
本文介绍了Postgresql列引用“ id”模棱两可的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试了以下选择:

SELECT (id,name) FROM v_groups vg 
inner join people2v_groups p2vg on vg.id = p2vg.v_group_id
where p2vg.people_id =0;

我得到以下错误列引用 id是不明确的。

and I get the following error column reference "id" is ambiguous.

事情是,如果我尝试相同的选择,但我只要求(name),而不要求id,它也可以工作。
我是新手,也许我错过了明显的东西。有什么建议么?

Thing is if I try the same select but I only ask for (name) , and not for id also, it works. I'm new to this and maybe I am missing something obvious. Any suggestions?

谢谢。

推荐答案

您需要输入表名/别名 SELECT 部分(也许(vg.id,name)):

You need the table name/alias in the SELECT part (maybe (vg.id, name)) :

SELECT (vg.id,name) FROM v_groups vg 
inner join people2v_groups p2vg on vg.id = p2vg.v_group_id
where p2vg.people_id =0;

这篇关于Postgresql列引用“ id”模棱两可的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆