Home > database >  Oracle SQL statements
Oracle SQL statements

Time:10-16

Uodate table a set address=(select names from the administrative region where b. b code=a. area code)
How to update when single subquery return multiple line error, should be how to write, to ask

CodePudding user response:

Update the wrong number

CodePudding user response:

You this correlation is more than 1 to relationship, so the mistakes and see your business logic, if this return multiple rows are repeated, in that you can use the distinct processing:
The update table a set address=(select distinct names from administrative region where b. b code=a. area code)

CodePudding user response:

Typo IDE don't tip

CodePudding user response:

Reason is that some of table b: the same code corresponding to the name of the different so there are repeated data, data, or if the data accuracy is not as wrote
Update table a set address=(select min (name) from the administrative region where b. b code=a. area code).
If required high accuracy will remove the table repeat b:
The following query out those who have repeated
Select the code from the administrative region group by having code (count (1) & gt; 1)
  • Related