I want to select all distinct rows where a value is at its minimum. Here's an example:
Item | Quantity | Line |
---|---|---|
Article 1 | 100 | 1 |
Article 1 | 240 | 2 |
Article 2 | 150 | 3 |
Article 2 | 140 | 4 |
Article 2 | 200 | 5 |
Article 3 | 45 | 6 |
Article 3 | 60 | 7 |
I want the result to be :
Item | Quantity | Line |
---|---|---|
Article 1 | 100 | 1 |
Article 2 | 150 | 3 |
Article 3 | 45 | 6 |
So basically i need the Quantity of every Item where Line as at its lowest value. How can I do it with SQL?