Try this
SELECT MIN( price ) as mPrice, `unique_url`
FROM `product_price`
WHERE `barcode` = '" . $product_barcode . "' AND `active` = '1'
GROUP BY `user_id`
ORDER BY mPrice ASC
LIMIT 1
Вопрос
I'm having trouble trying to select the lowest price and the unique url that's in the same row, at the moment it's getting the unique_url from the first row.
SELECT
MIN( price ), `unique_url`
FROM `product_price`
WHERE `barcode` = '" . $product_barcode . "'
AND `active` = '1'
GROUP BY `user_id`
ORDER BY `price` ASC
LIMIT 1
Help!
Решение
Try this
SELECT MIN( price ) as mPrice, `unique_url`
FROM `product_price`
WHERE `barcode` = '" . $product_barcode . "' AND `active` = '1'
GROUP BY `user_id`
ORDER BY mPrice ASC
LIMIT 1