how to get values from other table to update table

Recommended Answers

All 3 Replies

Member Avatar for LastMitch

@nagarajuapex

how to get values from other table to update table

Do you have this on your server? What version?

You didn't provide a table structure so I don't know what you have in your table.

Since you want to get a value from one table to another table. Kinda like a transfer.

You can try this example:

UPDATE a
SET a.field_1 = b.field_1
FROM table_a a
INNER JOIN table_b b
ON a.id = b.id;

Lastmitch I think above query will work on mysql

Nagarjun you can use MERGE query to update table from another table in oracle

merge destination_table d using source_table s on (d.key1=s.key1 and d.key2=s.key2)
when matched then update set d.colx=s.coly

commented: Nice Answer! I learn something from you! +0
Member Avatar for LastMitch

Lastmitch I think above query will work on mysql

I'm still trying to not confused myself with query in oracle or mysql.

The query you provided looks right!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.