我有一个MAssive sql查询......我内心加入的几个表...现在,我必须更新它们.. 我有Noooo想法如何做到这一点..这是我的查询(这是有效的)。 之后,我试图让更新声明工作的一种方式,但......我显然没有成功..
我的SQL查询是
select t1.name AS DistroName,t2.name AS OriginName, t3.name AS DesktopName, t3.name AS desktoptest , t2.country, t1.status, t2.description , t5.name as oldtest, t6.name as multitest, t4.name as begintest
from alldistros t1
LEFT join origin t2 on t1.name=t2.name
LEFT join desktop t3 on t2.name=t3.name
LEFT join beginnerdistributions t4 on t3.name=t4.name
LEFT join oldcomputers t5 on t4.name=t5.name
LEFT join multimedia t6 on t5.name=t6.name
WHERE t1.name = 'Absolute LInux'
现在我如何更新,比如说t1.name字段为“CatMan”,其中t1.name ='Absolute LInux'?
我确实无法在这种特殊情况下看到任何合乎逻辑的做法......
谢谢你,阮
答案 0 :(得分:1)
UPDATE alldistros SET name="CatMan" WHERE name = "Absolute Linux"
我认为你将表和查询的概念混淆了。
答案 1 :(得分:0)
这对你有用吗?
UPDATE alldistros
SET name = "CatMan"
from alldistros t1
LEFT join origin t2 on t1.name=t2.name
LEFT join desktop t3 on t2.name=t3.name
LEFT join beginnerdistributions t4 on t3.name=t4.name
LEFT join oldcomputers t5 on t4.name=t5.name
LEFT join multimedia t6 on t5.name=t6.name
WHERE t1.name = 'Absolute LInux'
也许我错误地阅读了这个问题,您是否想要更新名称所在的所有表名称列?