From c20fd9691ad585fc2fea2aaa754dec89f0deee1e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Garc=C3=ADa=20Aubert?= Date: Wed, 26 Oct 2016 13:16:24 +0200 Subject: [PATCH] Fix order in categories query to make it compatible with lenyends --- lib/cartodb/backends/turbo-carto-postgres-datasource.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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',