Mysql updating multiple tables
I belive fully portable or “platform-independent” SQL is mostly a myth.Writing generic “standard” SQL to the lowest common denominator almost certainly results in under-utilizing the RDBMS’s abilities.As an aside, to create primary key or unique indexes, follow the examples below.
This idea doesn't look possible without using IF EXISTS and sub queries checking for the ID in each table. Then construct an UPDATE query live time as a php string using only the tables where the id was found. re: UPDATE multiple tables I've decided to use four.
I ran into a situation today when I need to update 10,000 records in a master table totaling 1,000,000 rows, and the value that I’m going to use comes from the accounting department. In sum, accounting wants to update job 103’s invoice amount to 0 and job 104’s invoice amount to 0, while leaving all other amounts the same.
In this scenario, accounting only sent me two records, but in the real life situation I ran into, it was over 10,000 records.
As in life, the most important thing is to find a good balance and determine which criteria really matter.
If this article was useful to you, you should subscribe to stay current with my upcoming articles.