I have two tables: posts and custom_fields.
A post can have multiple custom_fields.
Posts table: id | title
Custom Fields table: id | post_id | custom_key | custom_value
What I want is show all posts, but show first the featured ones which are the ones that have: “custom_key = ‘featured’ AND custom_value=’1′”.
Not every posts have the custom_key=”featured”.
How can I make a mysql query that lists in this way?
Thank you!
Something like that should work: