Home > database >  According to the parent item update item statement, consult!
According to the parent item update item statement, consult!

Time:10-10

Oracle small white consult!
Use oracle database A table field: A1, A2, A3, A4, A5, A6, A1 field is 1, 1.1, 1.2, 1.3,... 2, 3,... 10, 10.1, 10.2... This serial number, 1.1 is 1 item, 1 is the father of 1.1 item, now want to use A table all parent updates, the corresponding item of the A4, A5, A6 value (example: use 1 A4, A5, A6 update 1 all item 1.1, 1.2... A4, A5, A6 fields, the corresponding A2, A3 values are equal) ask you how to write this update!

CodePudding user response:

You in the conditional query update can ah, character query item, and then update; But to be honest, A1 fields as 1,1.1 this kind of structure is a bit rash

CodePudding user response:

I have used the set=(select from the where) will be prompted to single subquery return multiple rows, with the merge into prompts unable to get a stable line in the source list

CodePudding user response:

Normal is set=(select from the where), the query returns multiple lines is written wrong, logic or data do not tally with the rules as you describe

CodePudding user response:

The update temp_simon2 a set (val1, val2)=(select val1, val2 from temp_simon2 b where trunc (Anderson, d)=b.i d and Anderson d<> B.i d)
Where trunc (Anderson, d) & lt;> Anderson, d

TB: temp_simon2
Id val1 val2
1 uf in hefei,
1.1 uf in hefei,
1.2 uf in hefei,
1.21 uf in hefei,
2 ladder up Beijing
Ladder 2.1 liters Beijing

CodePudding user response:

refer to the second floor krisyeollll response:
I have used the set=(select from the where) will be prompted to single subquery return multiple rows, with the merge into prompt unable to obtain a stable line in the source list


Because you this statement inside each record set in your (select from the where) in the query, select multiple records cause, you carefully manage the condition; If not emergency, table structure change, a lot of future trouble