select distinct d.icode,d.name,d.units,o.unitprice,sum(o.qty) as count ,sum(o.unitprice*o.qty) as total from opitemrece o
left outer join drugitems d on d.icode=o.icode
left outer join dtmain dt on dt.vn=o.vn
where dt.vstdate between '2010-03-01' and '2010-03-31' and o.icode like '1%'
group by d.icode
order by d.icode
ลองดูครับ ไม่แน่ใจเท่าไรครับ