Last active
June 5, 2020 09:13
-
-
Save jost125/ee290be240571a1fd5b9 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
UPDATE campaign_item | |
CROSS JOIN (SELECT @sort_order := 0, SET @campaign := 0) | |
SET sort_order = (@sort_order := IF(campaign_id = @campaign, @sort_order, (@campaign := campaign_id) - campaign_id) + 1) | |
ORDER BY campaign_id, sort_order, id; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment