简体   繁体   中英

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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