query help in joining tables
What about adding the where clause to the join itself?  Something like

left outer JOIN 
retail_append.nxr nxr 
ON (items.code = nxr.code AND nxr.categoryCode = 'wine')) and similar for the other with the item group code?