对不起-希望您不要介意我问这个问题,但是我是SQL的新手-有人可以对这段代码在代码中的含义进行评论吗?
select b.recipeuuid
,b.proditemuuid
,b.proditemvalueuuid
into #rectemp
from rec_recipe as a
inner join rec_recipevalue as b
on b.recipeuuid=a.recipeuuid
and b.[value] in ('Green','Yellow')
inner join rec_proditem as c
on c.proditemuuid=b.proditemuuid
inner join rec_proditemvalue as d
on d.proditemuuid=c.proditemuuid
and d.proditemvalueuuid=b.proditemvalueuuid
and d.[name]='SetupType'
;
update a
set a.[value]='1'
from rec_recipevalue as a
inner join #rectemp as b
on b.recipeuuid=a.recipeuuid
and b.proditemuuid=a.proditemuuid
and b.proditemvalueuuid=a.proditemvalueuuid
where a.[value] in ('Green','Yellow')
;
update a
set a.[name]='Normal'
from rec_proditemvalue as a
inner join #rectemp as b
on b.proditemuuid=a.proditemuuid
and b.proditemvalueuuid=a.proditemvalueuuid
where a.[name]='SetupType'
;
drop table #rectemp;
我了解这段代码的基本概念。它与如何更新(或更改)两个不同列的值有关:属性和颜色。在我使用适当的UUID将它们加入之前,这两个项目位于两个不同的表中。 仅当Attribute =“ SetupType”和Color =“ Green”或“ Yellow”
时,更新才可以放置我想将这两个值更改为:
Attribute ='Normal'和 颜色=“ 1”
答案 0 :(得分:0)
SelectedItems