0

I have a requirement to look at two tables and based on the column "id" where matching I need to replace the data in table "data" with what is in table "master data"

Here is table "data"

id      Required GPA
ZZZWD   2.2
EDFRD   4.0
DCFRE   
EDFRG   3.0

Here is table "master data"

id      Required GPA
ZZZWD   2.2
EDFRD   3.5
DCFRE   2.1
EDFRG   4.4

What is the most efficent way to do this?

1
  • Show us what you have tried first Commented Mar 6, 2016 at 20:02

1 Answer 1

2

This should work out for you:

UPDATE `data`, `master_data`
SET `data`.required_GPA = `master_data`.required_GPA
WHERE `data`.id <> `master_data`.id
AND (`data`.required_GPA is null OR `data`.required_GPA = '')
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.