select nume as "Nume", adresa as "Adresa",localitate as "Localitatea"
from info
left join angajati
on id_i = id_a
where localitate like "Orhei"
and year(curdate()) - year(data_nast) >=50
我有 2 个带有 number 字段的表,我收到错误,请帮助我,我现在不知道为什么此代码不起作用!!!
最佳答案
您需要定义 nume
字段应来自哪个表。这是使用表别名的一种方法:
select i.nume as "Nume",
adresa as "Adresa",
localitate as "Localitatea"
from info i
left join angajati a on id_i = id_a
where localitate like "Orhei"
and year(curdate()) - year(data_nast) >=50
使用联接
时,如果同一字段在多个表中表示,则必须定义要引用哪个表。
关于Mysql 字段列表中的列 'nume' 不明确错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33446949/