cod_Prod product seller price
123 A XPTO 10
123 A POTY 20
123 A MUY 15
And I querying max and min price of the producs as below:
select cod_Prod, product, max(price) as maxprice, min(price) as minprice
from tablename
group by cod_Prod, product
And I get this, which is correct:
cod_Prod product maxprice minprice
123 A 20 10
How can I get the seller with the highest and lowest price in the same query, like this output:
cod_Prod product maxprice seller_maxprice minprice seller_minprice
123 A 20 POTY 10 XPTO
