美文网首页
decode排序应用

decode排序应用

作者: Ernest_Chou | 来源:发表于2017-01-08 16:47 被阅读0次

将符合条件的排列在前面

select c.*,d.* from hsp.doctor_information d  left join 
 (select opds.doctor_code from PHONE.OUTP_PRESC_DEFAULT_SCHEDULE opds , 
 PHONE.CLINIC_SCHEDULE cs  where opds.clinic_label = cs.clinic_label
  and opds.hsp_config_baseinfo_id = cs.hsp_config_baseinfo_id group by opds.doctor_code ) c
 on d.hsp_staff_baseinfo_id=c.doctor_code
 order by  decode(c.doctor_code,null,9,1) 

尽量用group by 代替 distinct
用decode 、case 排序

相关文章

网友评论

      本文标题:decode排序应用

      本文链接:https://www.haomeiwen.com/subject/vvsfvttx.html