I’m having trouble getting this SQL to work. Basically I want to UPDATE the column sort_order and set it to the parents_sort_order which is selected by a subquery on the same table. Here’s my SELECT query showing the data I need….
SELECT p.id,p.sort_order,p.parent_id, (
SELECT `sort_order` AS parent_sort_order
FROM `product`
WHERE id = p.parent_id
)
FROM `product` p
WHERE p.dealer_id !=0
AND p.vendor_id >100
Thanks!
Join version of your select:
Update Option 1:
Update Option 2: