Go Back   CodingForums.com > :: Server side development > MySQL

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 08-17-2006, 05:04 PM   PM User | #1
bryan11
New to the CF scene

 
Join Date: Aug 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
bryan11 is an unknown quantity at this point
updating date based on search results

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.
bryan11 is offline   Reply With Quote
Old 08-17-2006, 05:37 PM   PM User | #2
devinemke
Regular Coder

 
devinemke's Avatar
 
Join Date: Dec 2004
Location: NYC
Posts: 443
Thanks: 0
Thanked 12 Times in 11 Posts
devinemke is an unknown quantity at this point
Code:
UPDATE invoices SET invoice_date = shipping_date WHERE company_name = 'XYZ'

Last edited by devinemke; 08-17-2006 at 07:24 PM..
devinemke is offline   Reply With Quote
Old 08-17-2006, 05:48 PM   PM User | #3
guelphdad
Super Moderator


 
guelphdad's Avatar
 
Join Date: Mar 2006
Location: St. Catharines, Ontario Canada
Posts: 2,629
Thanks: 4
Thanked 147 Times in 138 Posts
guelphdad will become famous soon enoughguelphdad will become famous soon enough
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.

Thanks,
Dave
guelphdad is offline   Reply With Quote
Old 08-17-2006, 07:21 PM   PM User | #4
bryan11
New to the CF scene

 
Join Date: Aug 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
bryan11 is an unknown quantity at this point
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.
bryan11 is offline   Reply With Quote
Old 08-18-2006, 01:06 PM   PM User | #5
guelphdad
Super Moderator


 
guelphdad's Avatar
 
Join Date: Mar 2006
Location: St. Catharines, Ontario Canada
Posts: 2,629
Thanks: 4
Thanked 147 Times in 138 Posts
guelphdad will become famous soon enoughguelphdad will become famous soon enough
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.
guelphdad is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 07:00 AM.


Advertisement
Log in to turn off these ads.