Hi, I have notice when using eloquent-power-joins can cause query problem.
So, eloquent-power-joins is using scope to simplify join query between relations, please take a look at this particular line of codes. If you notice, it will check if query has select, if not it will add SELECT * to query.
Since laravel-trend's aggregate method using selectRaw, the code I've shown (line 40) will return false, and add SELECT * to query, it cause problem since laravel-trend using groupBy to find aggregate columns.
I have solution for this problem by replacing this with this:
->select([
DB::raw("{$this->getSqlDate()} as date"),
DB::raw("{$aggregate}({$column}) as aggregate"),
])
I am sorry for my bad english, I hope you all can understand what I am trying to say. Thank you !
Hi, I have notice when using
eloquent-power-joins
can cause query problem.So,
eloquent-power-joins
is using scope to simplifyjoin
query between relations, please take a look at this particular line of codes. If you notice, it will check if query hasselect
, if not it will addSELECT *
to query.Since
laravel-trend
'saggregate
method usingselectRaw
, the code I've shown (line 40) will return false, and addSELECT *
to query, it cause problem sincelaravel-trend
usinggroupBy
to find aggregate columns.I have solution for this problem by replacing this with this:
I am sorry for my bad english, I hope you all can understand what I am trying to say. Thank you !
Info: Laravel 9, MySQL