-
-
Save Spriz/3862a1bee5a8d67ef7b85434e61be9ad to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$product = $this->Products->find() | |
->where(['Products.user_id IN' => [1, 2]]) | |
->order([ | |
'GREATEST(COALESCE(Projects.created, 0), COALESCE(Projects.modified, 0))' => 'DESC', | |
]) | |
->limit(10) | |
->offset(0); | |
debug($product->sql()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT FIELD1, FIELD2, FIELD3 | |
FROM products Products | |
WHERE (Products.user_id in (:c0,:c1) AND (Products.deleted) IS NULL) | |
ORDER BY GREATEST(COALESCE(Projects.created, 0), COALESCE(Projects.modified, 0)) DESC | |
LIMIT 10 OFFSET 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment