oracle sort specifies that a certain data is ranked first

select * from f_area ar where ar.status=1 and ar.parent_id=-1
ORDER BY DECODE(ar.area_code,'3101','1',ar.area_code)
--- specify the first


select of 3101 userid from tb
order by decode(userid,'f',null,userid) nulls first
-- when sorting, if it is f, it will be converted to null, otherwise unchanged
-- nulls first means null is in the front nulls last means null is in Behind

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326213735&siteId=291194637