title: mysql query to get preview data
body: <p>I have one table in which I have id and parent_id. In admin panel if user click on preview button it redirects to site with preview id. when we click on preview button, data save in table with it's id in 'parent_id' key.</p>
  
  <p>I created query and its working fine but it's displaying data in order but i want to replace parent row with preview row.</p>
  
  <pre><code>select * from wp_content
  where page='sharepoint_features'
  and (status='1' or (status='preview' and parent_id='146'))
  and id&lt;&gt;146
  </code></pre>
  
  <p>here 146 is parent id which we got form preview id</p>
  
  <p>by this query we have got following data</p>
  
  <p><a href="https://i.stack.imgur.com/2Hg6I.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/2Hg6I.png" alt="enter"></a></p>
  
  <p>in above table id 1303 should come after 145</p>