Records Duplicating after a Join
Hi Wez,
In the future, please include table structure (as CREATE TABLE
statements), some sample data (as INSERT statements) and expected output
when asking for help - it makes helping you a lot easier if I don't have
to guess! See http://www.aspfaq.com/5006 for more details.
Anyway, try if this helps:
SELECT o.OrderId, o.Code, o.OrderQty,
MIN(s.Location) AS Location
FROM Orders AS o
INNER JOIN Stock AS s
ON s.Code = o.Code
GROUP BY o.OrderId, o.Code, o.OrderQty
Best, Hugo
--
(Remove _NO_ and _SPAM_ to get my e-mail address)
|