Replace the {CHARACTER_ID}
by the character id you want to order
SELECT A.id,
A.`name_en`
FROM `asset` AS A
JOIN `character_fgimages` CA
ON CA.`asset_id` = A.`id`
WHERE CA.`character_id` = {CHARACTER_ID}
AND A.`is_deleted` = false
ORDER BY A.`order`
- Copy the query result from the above SQL to Sublime Text
- Find:
([0-9]+)(\t.*)
- Sort the line manually (Mac: ctrl + cmd + ↑ OR ↓, Window: ctrl + shift + ↑ OR ↓)
- Replace:
UPDATE `asset` SET `order` = {order} WHERE `id` = $1;
- Select all
{order}
- Use Text-Pastry to adding 1 for each selection (
\i
)