在 order by 中 使用 iif
select s.*,st.name as type_name from storage s,storage_type st,storage_item si where 1=1 and s.type_id=st.id and s.id=si.storage_id and si.order_by=1 and s.id>0
ORDER BY s.date desc,iif(s.status=0,0,1),s.id desc
select s.*,st.name as type_name from storage s,storage_type st,storage_item si where 1=1 and s.type_id=st.id and s.id=si.storage_id and si.order_by=1 and s.id>0
ORDER BY s.date desc,iif(s.status=0,0,1),s.id desc