Skip to content

Instantly share code, notes, and snippets.

@aczietlow
Created September 12, 2017 14:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aczietlow/6912fe87fe65a7e495df416d3ffcb8a9 to your computer and use it in GitHub Desktop.
Save aczietlow/6912fe87fe65a7e495df416d3ffcb8a9 to your computer and use it in GitHub Desktop.
Naturally sort numbers
SELECT DISTINCT commerce_product.product_id AS product_id, commerce_product.sku AS commerce_product_sku, commerce_product.changed AS commerce_product_changed, users_commerce_product.mail AS users_commerce_product_mail, users_commerce_product.uid AS users_commerce_product_uid, 'commerce_product' AS field_data_title_field_commerce_product_entity_type, 'commerce_product' AS field_data_field_special_commerce_product_entity_type
FROM
commerce_product commerce_product
ORDER BY LENGTH(commerce_product.sku), commerce_product.sku ASC;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment