由于您所发布的问题不够清楚,我将回答这个问题,假设您希望始终显示第一个不同的列。
SELECT DISTINCT ON (`tblproducts`.`product_id`) product_id,
`tbluserproducts`.`userproduct_id`,
`tblproducts`.`product_name`,
`tblproducts`.`category_id`,
`tbluserproducts`.`sku`,
`tbluserproducts`.`min_qty`,
`tbluserproducts`.`offer_price`,
MIN(tbluserproducts.offer_price) AS minimum,
`tbluserproducts`.`from_date`,
`tbluserproducts`.`to_date`,
`tbluserproducts`.`stock`
FROM `tblproducts`
JOIN `tbluserproducts` ON tblproducts.product_id = tbluserproducts.product_id
WHERE (`tbluserproducts`.`status`=1) AND (`tblproducts`.`status`=1)
AND (`tblproducts`.`category_id`='132')
GROUP BY `tbluserproducts`.`userproduct_id`
ORDER BY product_id DESC LIMIT 5