Hi i am trying to order my database by comma separated value but it doesn’t seem to be working correctly for me. here is my mysql query.
SELECT *
FROM wp_posts
LEFT JOIN wp_postmeta ON wp_posts.ID=wp_postmeta.post_id
LEFT JOIN wp_term_relationships ON wp_posts.ID=wp_term_relationships.object_id
LEFT JOIN wp_term_taxonomy ON wp_term_relationships.term_taxonomy_id=wp_term_taxonomy.term_id
LEFT JOIN wp_terms ON wp_term_taxonomy.term_id=wp_terms.term_id
WHERE wp_terms.name = 'Dimmers'
AND meta_key = 'feature_number_of_channels'
GROUP BY wp_posts.ID
ORDER BY meta_value ASC
And here is a screenshot.

As you can see from the screenshot they dont seem to be working correctly any help please on how to order these ASC correctly???
Correct order i am looking for is so the highest out of them all then ASC like this
24,48 – 4,6,12,24 – 12 – 6 – 6 – 3
Change your
ORDER BYto look at the integer value of the string :Here’s an example:
returns:
Good luck!