Welcome to the nuBuilder Forums!

Register and log in to access exclusive forums and content available only to registered users.

SQL syntax question

Questions related to customising nuBuilder Forte with JavaScript or PHP.
Post Reply
icoso
Posts: 181
Joined: Sun Feb 07, 2021 11:09 pm
Been thanked: 1 time

SQL syntax question

Unread post by icoso »

I have two tables in my database.

NewTable1 has all of my data in it that I copied from OldTable1,OldTable2,OldTable3,OldTable4. I need to update the records in NewTable1 with data from OldTable2 where the nuID is the same value. The field that I need to update is fieldname10 in both tables. The NewTable1 has the SAME nuID that is on each of the records that are in OldTable1 thru 4 which means that for each record in the OldTable that same nuID is in the NewTable1.

What would an UPDATE MYSQL statement look like to update the field (fieldname10) in all the records in NewTable1 with the same field from OldTable2 WHERE the NewTable1.nuID = OldTable2.nuID ?

ANy suggestions would be helpful.
kev1n
nuBuilder Team
Posts: 4305
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 445 times
Contact:

Re: SQL syntax question

Unread post by kev1n »

Use an UPDATE together with a JOIN.

Easy and understandable tutorial:
https://www.mysqltutorial.org/mysql-update-join/
Post Reply