SQL syntax question

Questions related to customising nuBuilder Forte with JavaScript or PHP.

SQL syntax question

Unread postby icoso » Thu Jun 17, 2021 5:06 am

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.
Posts: 181
Joined: Mon Feb 08, 2021 7:39 am
nuBuilder Version: 4.5

Re: SQL syntax question

Unread postby kev1n » Thu Jun 17, 2021 1:15 pm

Use an UPDATE together with a JOIN.

Easy and understandable tutorial:
nuBuilder Team
Posts: 2057
Joined: Mon Oct 15, 2018 2:13 am
nuBuilder Version: 4.5

Return to Custom Code

Who is online

Users browsing this forum: No registered users and 9 guests