Last active
August 29, 2015 14:16
-
-
Save mattisbusycom/477305a0dca2e2c53048 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SET SQL_MODE = ''; | |
SET @rownum=0; | |
UPDATE eav_attribute_option | |
LEFT JOIN ( | |
SELECT tmp.*, @rownum:=@rownum+1 AS rank FROM ( | |
SELECT eao.*, eaov.`value` | |
FROM eav_attribute_option eao | |
LEFT JOIN `eav_attribute_option_value` eaov ON eao.option_id=eaov.option_id AND eaov.store_id=0 | |
WHERE attribute_id = 292 | |
ORDER BY CAST(CAST(eaov.value AS DECIMAL(3,0)) as UNSIGNED INTEGER), eaov.value | |
) tmp | |
) src ON eav_attribute_option.option_id = src.option_id | |
SET eav_attribute_option.sort_order = src.rank |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment