views:

513

answers:

2

How can I use the following query:

SELECT *
FROM `laps`
WHERE `id` = (
  SELECT `id`
  FROM `laps` AS `alt`
  WHERE `alt`.`user_id` = `laps`.`user_id`
  ORDER BY `lap_time` ASC
  LIMIT 1 )
ORDER BY `lap_time` ASC

in my CakePHP app and paginate the results?

A: 

what you actually want is how to do custom pagination query. there's some info about that here

zam3858
A: 

convert your query to join way, then use cake custom pagination.

alx