select order by inactive first