1. 程式人生 > >oracle中使用instr按指定順序排序

oracle中使用instr按指定順序排序

select sei.office_name, nvl(ROUND(AVG(sei.COMP_CHECK), 2), 0) avg_score
  from SECURITY_EMPLOYEE_INFO sei
 WHERE sei.office_name in ('運輸處', '貨運處', '客運處', '機務處', '工務處', '電務處', '車輛處', '供電處')
   and (SEI.ON_GUARD IS NULL OR SEI.ON_GUARD = 0)
 group by sei.office_name
 --order by avg_score desc
 order by instr('運輸處, 貨運處, 客運處, 機務處, 工務處, 電務處, 車輛處, 供電處', sei.office_name);