I've tried using the search but besides it not being possible the 'easy' way, I can't find anything specific to my function. I *think* it'll be some sort of subquery, but I'm only just getting used to writing SQL by hand so still need a little guidance...
I need the minimum cost, grouped by PID. But I also need SID to pull through - but I can't include it without using GROUP BY, which doesn't bring the required result.
Sample
---
PID SID Cost
1 1 9
1 2 8
2 3 9
2 4 10
Result wanted
---
PID SID Cost
1 2 8
2 3 9
Thanks in advance!
I need the minimum cost, grouped by PID. But I also need SID to pull through - but I can't include it without using GROUP BY, which doesn't bring the required result.
Sample
---
PID SID Cost
1 1 9
1 2 8
2 3 9
2 4 10
Result wanted
---
PID SID Cost
1 2 8
2 3 9
Thanks in advance!