MySQL Forums
Forum List  »  Newbie

Re: Query-Regarding
Posted by: Peter Brawley
Date: July 25, 2016 10:15AM

Is this what you mean?

update nmp.sales a
join nmp.purchase b using(barcode,department)
set a.act_days_to_sell=(timestampdiff(day,b.purentrydate,a.entrydate));

If you're not sure, first run it as a Select query to check that it's finding the desired rows ...

select a.act_days_to_sell,a.entrydate,b.purentrydate,timestampdiff(day,b.purentrydate,a.entrydate) as diff
from nmp.sales a
join nmp.purchase b using(barcode,department);

Options: ReplyQuote


Subject
Written By
Posted
July 25, 2016 03:07AM
Re: Query-Regarding
July 25, 2016 10:15AM
July 25, 2016 10:11PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.