Skip to content

Instantly share code, notes, and snippets.

@heathdutton
Created August 31, 2018 14:02
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
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