Answer the question
In order to leave comments, you need to log in
Answer the question
In order to leave comments, you need to log in
UPDATE dataset d
SET d.price =
(SELECT TOP 1 price FROM dataset d1 WHERE
d.good_id=d1.good_id AND d.owner_id=d1.owner_id AND d1.price IS NOT NULL AND
d1.year_id<=d.year_id AND d1.week_number<=d.week_number
ORDER BY d1.year_id DESC, d1.week_number DESC)
WHERE d.price IS NULL
For SQL, there should always be a certainty: "as soon as possible" should become "nearest". And what to do with the goods if there is no such price.
show the code ... according to the screenshots, they guess at otvet.mail.ru/magic/
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question