Closed rikvdh closed 2 days ago
Ok, I've made a testcase which now is broken in v11.33.0:
Returns::groupBy('orders.locale')
->join('orders', 'orders.id', 'order_id')
->having('nreturns', '>', 10)
->selectRaw('orders.locale,returns.created_at,count(distinct returns.id) as nreturns')
->min('returns.created_at')
The having clause seems to break the query, this makes the 'orders.locale' invalid outside the subquery.
@rikvdh Can you create a simple TestCase that would cover this usage?
Reverted.
Laravel Version
11.33.0
PHP Version
8.3.14
Database Driver & Version
MariaDB
Description
The behavior is changed in PR #53209. I've built queries in my application which I need further on. But now the behavior changed for aggregate-functions like:
min(...)
,max(...)
.When having joins and aggregations with custom selects from joined tables I've seen other issues producing invalid SQL queries due to the subquery existing and columns not existing outside the subquery. But I cannot make an isolated testset and the query is too big.
Steps To Reproduce
in 11.32.0:
returns int.
in 11.33.0:
returns collection.