This is the current SQL query I am working with:
SELECT Merchant.Product, Merchant.Name, Merchant.Price
FROM a_table AS Merchant
JOIN
(
SELECT Product, MIN(Price) AS MinPrice
FROM a_table
GROUP BY Product
) AS Price
ON Merchant.Product = Price.Product
AND Merchant.Price = Price.MinPrice
From this data set:
Product    Name         Price   
11          Merch1      19.00   
11          Merch2      20.00
11          Merch3      19.00
11          Merch4      19.50
12          Merch1      20.00   
12          Merch2      20.00
13          Merch1      17.00
13          Merch3      15.00
The current SQL outputs multiple product records when prices are the same like this:
Product    Name         Price   
11          Merch1      19.00
11          Merch3      19.00   
12          Merch1      20.00
12          Merch2      20.00   
13          Merch3      15.00
I want to Group By product and display the lowest price with corresponding row data. If two prices are the same on a product, use first record found.
Trying to get this result:
Product    Name         Price   
11          Merch1      19.00   
12          Merch1      20.00   
13          Merch3      15.00
 
    