I need to run a query that updates “table 1 > returned” to a value of 1 when it’s “model & serial” matches the “model & serial” found in table 2. The company involved does not use the serial number as a unique value - it uses the combination of both. When a product is returned to them, they upload nothing more than the model and serial to “table 2”.
With a single field I would have no problems doing this, but I am questioning the proper procedure when I need to compare both fields.
For the record: Table1 holds hundreds of thousands of records, and table2 gets about 500 per week.
Quick question, that likely has a can of worms for an answer.
When I run this query through PHPMyAdmin it updates 500 records in about 4 minutes. During that time, the server is very responsive on the front end, and admin area. No problem bouncing around the site.
If I run the same query through a very, very simple PHP file - the update takes the same amount of time but consumes a lot more resources. I can’t even visit a page on the server while it updates.
What should I be looking at as a possible problem? Both the site and PHPMyAdmin use the same PHP config, and MySQL DB.
Thank for the reply to the thread which i found useful but need more. This is how I used it but want to be sure. The tables there in are actual.
update rmc_raw_data
INNER
JOIN handover_main
ON handover_main.handover_time = rmc_raw_data.rmc_time
AND handover_main.handover_date = rmc_raw_data.rmc_date
SET rmc_raw_data.handover = “Handover”;
the query returns one result which i manually checked and is correct. since the records are numerous, i need a way to check if the query is working correctly.
However, the query searches for for date and time in one table and match them with date and time in another table and if there is a match, it inserts handover in one of the tables.
I need a way to validate the result of the query. Please suggest. Many thanks.