July 20, 2011 at 7:22 am
Since you want columns not included in the MIN function, you'll need to use a subquery to get those min values by material ID then join to that to get the Supplier ID.
NOTE: This does not handle Suppliers with the same Rate !!!!
SELECT s.SupplierID, s.MaterialID, s.Rate
FROM SupplierRate AS s
INNER JOIN (SELECT MaterialID, MIN(Rate) AS Rate
FROM SupplierRate
WHERE Rate > 0
GROUP BY MaterialID) as minRate
ON minRate.MaterialID = s.MaterialID
AND minRate.Rate = s.Rate
ORDER BY s.MaterialID
______________________________________________________________________
Personal Motto: Why push the envelope when you can just open it?
If you follow the direction given HERE[/url] you'll likely increase the number and quality of responses you get to your question.
Jason L. SelburgJuly 20, 2011 at 7:43 am
thanks you sir i got my result !!!
Viewing 2 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply