select *
from (
select `competition_rounds`.*, `competition_id`, (
select count(*) from `competition_round_players` where `competition_rounds`.`id` = `competition_round_players`.`competition_round_id`
) as `players_count`, row_number() over (PARTITION BY competition_id ORDER BY id desc) as adonis_group_limit_counter
from `competition_rounds`
where `competition_id` in (28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 1)
order by `id` desc
) as `adonis_temp`
where `adonis_group_limit_counter` <= 1
- Duplicate column name 'competition_id'
After a bit of debugging, i saw that introducing withCount will duplicate the competition_id column because it adds it after select competition_rounds.*
That, combined with groupLimit will cause the whole query to be surrounded by a select * from (select....)
But the main issue is the duplication of the competition_id column
Package version
21.1.0
Describe the bug
Here are my 3 models
Here is the query i'm trying to run:
And here is the issue:
After a bit of debugging, i saw that introducing
withCount
will duplicate thecompetition_id
column because it adds it after select competition_rounds.*That, combined with
groupLimit
will cause the whole query to be surrounded by aselect * from (select....)
But the main issue is the duplication of the competition_id column
Reproduction repo
No response