This question describes exactly what I want to do, but I want to do it in CakePHP 2.10. Is it possible? Is it in general possible to 'unroll' sub-expressions in SQL? I've tried just about every combination of which I can think, and generally receive the
Expression #n of SELECT list is not in GROUP BY clause and contains nonaggregated column 'database.table.id' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by
I understand why (there are plenty of explanations on StackOverflow), and want to fix it properly, but within the constraints of the CakePHP 2.10 framework. I also want to avoid having to rewrite or restructure a lot of existing code into which this usage must fit, so don't want to use prepared statements or direct query()
calls. Is it possible?