Home > database >  Oracle gives a table field values to another table's field values
Oracle gives a table field values to another table's field values

Time:10-05

Such as table A
Task_id opeti
1
1
1
2 ceshi_a

Table B
Task_id opeti
1 xiugaiceshi
1 xiugaiceshi 1
1 xiugaiceshi 2
2 ceshiceshi


Need to put the table in A task_id=1 opeti value into task_id values in table B=1 opeti value, how to achieve this? Small white one, hope the great god glad, thank you.

CodePudding user response:

In order to update?

CodePudding user response:

Such as table A
Task_id cgi opeti
1, 010-010
1, 010-020
1, 010-010
2, 011-111 ceshi_a

Table B
Task_id cgi opeti
1, 010-010 xiugaiceshi
1, 010-012 xiugaiceshi 1
1 xiugaiceshi 2, 010-010
2, 022-011 ceshiceshi


Just now for example may not be too seriously, should be three fields, the need is to table A task_id=1 and watch A cgi in=B in the value of the cgi corresponding update opeti table A and table B is associated with cgi, then opeti task_id=1 table B of value added to the table in A corresponding opeti task_id and cgi, thank the moderator's adult,

CodePudding user response:

 - let's see if this can meet your requirement 
Update a
Set op=(select the op the from b where Anderson, d=b.i d and a.c gi=biggest gi)
Where the exists (select * from b where Anderson, d=b.i d and a.c gi=biggest gi)

CodePudding user response:

Tip is "ora - 01427: single subquery return multiple rows"

CodePudding user response:

Opeti column number what are the rules?

CodePudding user response:

Opeti column content is no rules

CodePudding user response:

Task_id cgi opeti
1, 010-010 xiugaiceshi
1, 010-012 xiugaiceshi 1
1 xiugaiceshi 2, 010-010


This situation, the same id, cgi also same, pick up which op?

CodePudding user response:

Such as table A
Task_id cgi opeti
1, 010-010
1, 010-021
1, 010-011
2, 011-111 ceshi_a

Table B
Task_id cgi opeti
1, 010-010 xiugaiceshi
1, 010-021 xiugaiceshi 1
1 xiugaiceshi 2, 010-011
2, 022-011 ceshiceshi

Confirmed that under the same task_id, cgi is not repeated, which is under the same table cig is the only, how to achieve that? Write a moderator adult @ wmxcn2000

CodePudding user response:

Is such as I think all the B task_id=1 opeti field values in the table is assigned to A table corresponding task_id and cgi opeti fields,
  • Related