I am trying to sort the subquery (joined table) result by using order by id DESC. I am unable to implement this.
I used the following query to sort Table2 in DESC order by id, which is not correct.
$result = $this->Table->find('all', ['contain' => ['Table2' => ['order' => ['id' => 'desc']]]])->where(['col1' => $col1, 'col2' => $col2])->order(["col3" => 'desc'])->toArray();
Is there any other way available?
We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.