We're a community of 1076K IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,075,809 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

how to get values from other table to update table

how to get values from other table to update table

3
Contributors
3
Replies
21 Hours
Discussion Span
4 Months Ago
Last Updated
6
Views
nagarajuapex
Newbie Poster
2 posts since Jan 2013
Reputation Points: 0
Solved Threads: 0
Skill Endorsements: 0

@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
Industrious Poster
4,132 posts since Mar 2012
Reputation Points: 132
Solved Threads: 334
Skill Endorsements: 45

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

urtrivedi
Posting Virtuoso
1,714 posts since Dec 2008
Reputation Points: 299
Solved Threads: 362
Skill Endorsements: 24

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!

LastMitch
Industrious Poster
4,132 posts since Mar 2012
Reputation Points: 132
Solved Threads: 334
Skill Endorsements: 45

This article has been dead for over three months: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
 
© 2013 DaniWeb® LLC
Page rendered in 0.0653 seconds using 2.7MB