$v = array(1,11.38,15.8);
$sortByPrice = $this->Product->query
(
"SELECT *,
CASE `Product`.`currency`
WHEN '1' THEN $v[0]
WHEN '2' THEN $v[1]
WHEN '3' THEN $v[2]
END AS 'ratio'
FROM `products` AS `Product`
LEFT JOIN `marks` AS `Mark` ON (`mark_id` = `Mark`.`id`)
LEFT JOIN `categories` AS `Category` ON (`category_id` = `Category`.`id`)
RIGHT JOIN `photos` AS `Photo` ON (`Photo`.`product_id` = `Product`.`id`)
ORDER BY price*ratio DESC"
);
如何对这个查询进行分页?我在 book.cake 上读过,但解释得不是很好