How to set each products' popularity (only when sales > 1) to that of the most popular product (from the same brand) in the same table. I have this so far:
UPDATE Products
SET popularity=
(
SELECT TOP 1 popularity FROM products
WHERE brand = currentRow.brand
)
WHERE sales > 1
Obviously 'currentRow' can't exist since like this, so...
I was also looking into this answer, but no luck so far.
Would it just be better to iterate/loop over each row, check the condition, and update if necessary?