June 22, 2006 at 7:46 am
Hello,
I have a question that i'm sure some of you guys can answer for me in 5 seconds flat and yet it'd take me hours to figure it out. Here it is:
say I have a Prod table that contains itemid and a manufacturerid.
Each manufacturer can have multiple products. I need to pull a distinct list of manufacturers and 1 product that belongs to them. So to for example if my Products table has 6 rows like this:
manufacturerA prod1
manufacturer A prod2
manufacturer A prod3
Manufacturer B prodx
Manufacturer B prody
Manufacturer B prodz
the result of the query would be:
Manufacturer A prod1
Manufacturer B prodx
Can u please help?
June 22, 2006 at 7:55 am
SELECT manufacturerid, MIN(itemid) AS [itemid]
FROM [Prod]
GROUP BY manufacturerid
ORDER BY manufacturerid
Far away is close at hand in the images of elsewhere.
Anon.
June 22, 2006 at 8:11 am
Awesome, thanks!
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply