gpt4 book ai didi

Mysql 字段列表中的列 'nume' 不明确错误

转载 作者:行者123 更新时间:2023-11-29 11:54:33 24 4
gpt4 key购买 nike

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/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com