ตามนี้เลยครับ
select d1.*,v1.*,o1.*,s1.name as spclty_name,p1.drugallergy,p1.nationality,p1.citizenship,
p2.pttype as pttype_pttype,p2.name as pttype_name,p2.pcode as pttype_pcode,
p2.requirecode as pttype_requirecode,p2.require_hcode as pttype_require_hcode,
concat(if(d1.patient_address is null,'',d1.patient_address),' โทร. ',
if((p1.hometel is null or p1.hometel = ''),' - ',p1.hometel)) as patient_address_tel
from doctor_order_print d1
left outer join vn_stat v1 on v1.vn = d1.vn
left outer join ovst o1 on o1.vn = d1.vn
left outer join patient p1 on p1.hn = d1.hn
left outer join spclty s1 on s1.spclty = o1.spclty
left outer join pttype p2 on p2.pttype = v1.pttype
left outer join s_drugitems sd on sd.icode = d1.icode
left outer join drugitems di on di.icode = d1.icode
where d1.vn = '551211104123'
order by sd.income,di.therapeuticgroup,sd.name