I am reposting this question. I have cleaned up the SQL but there are still a few duplicate results. I need to find the most recent data for each itemnum in each location. Here's what I have:
SELECT invbalances.itemnum,
invbalances.curbal,
inventory.maxlevel,
inventory.minlevel2,
inventory.sstock,
inventory.deliverytime,
invbalances.location,
inventory.category
FROM MX7PROD.dbo.invbalances invbalances,
MX7PROD.dbo.inventory inventory
WHERE invbalances.itemnum = inventory.itemnum
AND invbalances.location = inventory.location
AND ((inventory.category<>'cstk'
And inventory.category<>'nore'
And inventory.category<>'sp')
AND (invbalances.itemnum Not Like '%n%'))
ORDER BY invbalances.itemnum