diff --git a/lib/cartodb/backends/turbo-carto-postgres-datasource.js b/lib/cartodb/backends/turbo-carto-postgres-datasource.js index 79e718ea..8c0a93c7 100644 --- a/lib/cartodb/backends/turbo-carto-postgres-datasource.js +++ b/lib/cartodb/backends/turbo-carto-postgres-datasource.js @@ -32,7 +32,7 @@ methodTemplates.category = dot.template([ ' SELECT {{=it._column}} AS category, count(1) AS value, row_number() OVER (ORDER BY count(1) desc) as rank', ' FROM ({{=it._sql}}) _cdb_aggregation_all', ' GROUP BY {{=it._column}}', - ' ORDER BY 2 DESC', + ' ORDER BY 2 DESC, 1 ASC', '),', 'agg_categories AS (', ' SELECT category',