简体   繁体   English

为什么使用我的 SELF-JOIN 会出错?

[英]Why does using my SELF-JOIN gives me error?

select 1.jmeno, 1.nadr
from zam as 1,
    zam as 2
where 1.nadr = 2.nadr
group by 1.jmeno, 1.nadr;

You need to change your alias name of the tables您需要更改表的别名

select a1.jmeno, a1.nadr
from zam as a1 join
    zam as a2
on a1.nadr = a2.nadr
group by a1.jmeno, a1.nadr

use alias name by starting with letter and use explicit join not coma separated join使用以字母开头的别名并使用显式连接而不是逗号分隔连接

select t1.jmeno, t1.nadr
from zam as t1 join  zam as t2
on t1.nadr = t2.nadr

as there is no aggregation in your query so i removed group by instead that you could use distinct因为您的查询中没有聚合,所以我删除了 group by 而您可以使用distinct

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM