sql - mysql left join order by -


i have property pictures in table sort_order starting 0 number of pictures. select pictures start 2 . approach ;

        select * property_photos pp1          join property_photos pp2 on pp1.p_id = pp2.p_id          pp2.sort_order =2          , pp2.sort_order <2          , pp1.sort_order >2          , pp1.p_id = 3 

so trying gain here sort order 2,0,1,3,4,5,6,7

so need self join query doesnt work

you don't need join on this,

select * property_photos p_id = 3 order (sort_order = 2) desc, sort_order 

Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -