title: Order by with where IN operator
body: <p>How to make a query to mysql database to sort the results in descending order with condition that if a particular item present in list comes first.
  For example I have a table of some post 'post_feeds' article which is mapped with category in category map table 'post_category_mapping'. I try to retrieve all posts from table 'post_feeds' in sorted order but with condition that if category_id present in list come first.</p>
  
  <p>I try to do this by this query :</p>
  
  <pre><code>SELECT DISTINCT post_category_mapping.post_id,
                  posts_feeds.post_title
  FROM post_category_mapping
  INNER JOIN posts_feeds
      ON post_category_mapping.post_id = posts_feeds.post_id
  ORDER BY CASE WHEN post_category_mapping.category_id IN (1,6)
                THEN posts_feeds.id END DESC,
           posts_feeds.id DESC"
  </code></pre>