Try something like this:select distinct invhist.itemno, sum(invhist.qty), items.categoryfrom invhistinner join itemson invhist.itemno=items.itemnowhere category in ('AIRGUNS', 'AIRPISTOLS', 'AIRSOFT', 'Airsoftpistols', 'AirsoftRifles','AIRRIFLES')and invhist.doc_type = 9and invhist.date_fld between '2010' and '2011'group by invhist.itemno, items.categoryorder by invhist.itemnoSome days you're the dog, and some days you're the fire hydrant.