按sort排序,sort为空的在后面 select * from 表名 order by (case when sort is null or sort='' then 1 else 0 end),sort
select t.*, t.rowid
from hs_tr_goods_attach_rel t
order by (case
when t.goods_order is null or t.goods_order = '' then
1
else
0
end),
t.goods_order