[ Operator({ 'SQL.Naive' => 'apply' }, [ Identifier('COUNT'), Identifier('*') ]) ],
Where(
Operator(
- { 'SQL.Naive' => ($first_order->{reverse} ? '>' : '<') },
- [ Identifier($count_alias, $count_col), $first_order ]
+ { 'SQL.Naive' => ($remapped{inside_order}[0]{reverse} ? '>' : '<') },
+ [
+ Identifier($count_alias, $count_col),
+ $remapped{outside_order}[0]{by}
+ ]
),
Alias($count_alias, $first_from)
)