今天遇到一个从数据库的同一表中按不同条件取记录集然后按记录集顺序排序的问题,从网上直接找到了办法,很简单,一条SQL语句搞定。
SELECT 0 as type,* FROM Company WHERE companyid in (10)UNIONSELECT 1 as type,* FROM Company WHERE companyid not in (10)