gpt4 book ai didi

MYSQL 更新与连接

转载 作者:行者123 更新时间:2023-11-29 11:20:31 25 4
gpt4 key购买 nike

运行查询时:

UPDATE video v,akadam_post a,location l 
SET v.location_id=l.id
WHERE a.encoding_id=v.id AND l.continentCode=a.loc_continent_code AND
l.countryCode=a.loc_country_code AND l.regionCode=a.loc_region_code AND
l.cityCode=a.loc_city_code

我收到语法错误,知道吗?

10:04:02    select id,encoding_id from akadam_post a left join location l on l.continentCode=a.loc_continent_code AND l.countryCode=a.loc_country_code AND l.regionCode=a.loc_region_code AND l.cityCode=a.loc_city_code  UPDATE video v,akadam_post a,location l SET v.location_id=l.id  WHERE a.encoding_id=v.id AND l.continentCode=a.loc_continent_code AND l.countryCode=a.loc_country_code AND l.regionCode=a.loc_region_code AND l.cityCode=a.loc_city_code  Error Code: 1064. You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'UPDATE video v,akadam_post a,location l SET v.location_id=l.id  WHERE a.encoding' at line 3    0.00051 sec

谢谢!

最佳答案

语法不正确,应该是

update video v
join akadam_post a on a.encoding_id=v.id
join location l on l.continentCode=a.loc_continent_code
and l.countryCode=a.loc_country_code and l.regionCode=a.loc_region_code
and l.cityCode=a.loc_city_code
set v.location_id=l.id

关于MYSQL 更新与连接,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39012937/

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