addSubSelect

(select
{{group_by_col}},
max({{max_col}}) max_{{max_col}}
from
{{table}}
group by 1) as max_{{table}}