I've been googling for an answer but am not even sure how to phrase my search on this question. Here's the situation: I have a real estate database with 2 tables. The first is a listing of all houses for sale in the market, updated daily on an automatic basis (via cron.) The other is a listing of just the homes available through a certain agency. I am trying to do an update of the second database that does 2 things, A. Inserts new homes from Table1 into Table2 and B. Updates the existing information from Table2 with current information from Table1 (price changes, etc.)
I have accomplished part A using the following code:
$query = "INSERT IGNORE INTO table2 SELECT * FROM table1 WHERE table1.category='XXXXX'";
I'm having trouble coming up with proper code for the second part. There is additional information added to the rows in Table2 so I know I need to use update to change just the new information but I'm not certain how to use the right variables.
Ok, for my actual question without the background, here it is:
How do I perform an UPDATE of multiple records, matching a certain criteria, but not all records?
Thanks