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.
I created query and its working fine but it's displaying data in order but i want to replace parent row with preview row.
select * from wp_content
where page='sharepoint_features'
and (status='1' or (status='preview' and parent_id='146'))
and id<>146
here 146 is parent id which we got form preview id
by this query we have got following data
in above table id 1303 should come after 145
Here is a possible work around based on @JoeTaras solution:
Here is a sqlfiddle with what I assume is your data structure.