ลอง select distinct( o.hn),concat(p.pname,p.fname,"" ,p.lname) as pat from opitemrece o
left outer join patient p on p.hn=o.hn
where o.icode like "332%" and o.icode not like "1%"
and o.income ="02"
and o.rxdate between"2013-10-01" and "2014-06-30"
limit 50