Sunday, February 19, 2012

display only the listing with the lowest price (was "Need a little help here....

I have a little problem that I just haven't been able to solve. I don't think it is very difficult but I can't seem to make it work. Here's the scenario:

I have a database with the following values:
Model Make Price
DA1100 GTN $88.00
DA1100 GTN $100.00
DA1000 GBN $110.00
DA668 GTN $100.00
DA880 GTN $200.00

In this case DA1100 is listed twice with 2 different prices. I only want to display the one with the lowest price. So the result I want is:
Model Make Price
DA1100 GTN $88.00
DA1000 GBN $110.00
DA668 GTN $100.00
DA880 GTN $200.00select Model,
Make,
min(Price) as MinPrice
from UrTableName
group by Model,
Make

No comments:

Post a Comment