I Need help. There is a table of goods There is a price table The goods have the group_id attribute. Several goods with different prices can be combined into a group. Need to under GROUP BY group_id to do sorting on price. I managed to make such a request to the database
SELECT i.group_id
, min(istock.retail) price
FROM item i
LEFT JOIN item_stock istock ON istock.item_id = i.id
WHERE i.public = 1
AND i.`status` = 'actual'
AND i.id IN(10685, 2759, 10686, 1644, 894, 7302, 7328, 6717, 8885)
GROUP BY i.group_id
ORDER BY price ASC
;
But there is no field in the model
min(istock.retail) price
Can someone help shift this request to Phalcon\Mvc\Model\Criteria