Skip to content

Instantly share code, notes, and snippets.

@heathdutton
Created August 31, 2018 14:02
Show Gist options
  • Save heathdutton/63ffc4a96314238bd4dbd055c2d34243 to your computer and use it in GitHub Desktop.
Save heathdutton/63ffc4a96314238bd4dbd055c2d34243 to your computer and use it in GitHub Desktop.
Put all Mautic Custom fields into alphabetical order by label.
UPDATE lead_fields AS f
CROSS JOIN (
SELECT @cnt := 0
) AS dummy
JOIN (
SELECT (@cnt := @cnt + 1) AS cnt, id
FROM lead_fields
CROSS JOIN (SELECT @cnt := 0) AS dummy
ORDER BY label ASC
) AS c
SET f.field_order = c.cnt
WHERE f.id = c.id;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment