View Full Version : updating date based on search results

08-17-2006, 06:04 PM
What's the best way to do this? I need to search an invoice table. For a specific company name, I need to update all invoice dates to match their shipping dates. In other words, I need to search for a company name, and for each match update the invoice date to be the shipping date.

08-17-2006, 06:37 PM
UPDATE invoices SET invoice_date = shipping_date WHERE company_name = 'XYZ'

08-17-2006, 06:48 PM
devinemke, when seeing this type of question please try to see what the user has attempted and see if you can steer them to the answer. This looks quite familiar as a homework type of question. As a general rule we don't want these type of questions answered without input from the original poster.

bryan11 if it is a homework question please read the Rules and Posting Guidelines for future posting information.


08-17-2006, 08:21 PM
You have a good point, guelphdad, but this just a minor fire fighting task, not homework. I've just been thrown into a project with PHP and MySQL where I'm not that familiar with either yet. Using Google with "MySQL update date based on results" to find an answer wasn't working well.

08-18-2006, 02:06 PM
No problem bryan, it is just a common occurance on this and other discussion boards so I'd thought I'd point it out to our users who can learn from it in the future.