Going to have an sql test in a few days. We can't use a computer so everything is written without its help.
I'm having some issues with this exercise.
The objective is to update the values of the table purchase
using the values from the table product
. If the product.production_date
is highest than sold.purchase_date
it's necessary to set the purchase_date
to be equal to production_date
.
Here's what I did:
update purchase
set purchase_date=product.production_date
from product
where purchase.purchase_date<product.production_date;
Can I do this? I mean, use the update and from commands together?
Thank you.