From 08c6a18abfa5bfd4630bb4761892f4b430963615 Mon Sep 17 00:00:00 2001 From: Iakov GAN <82834333+iakov-aws@users.noreply.github.com> Date: Fri, 27 Oct 2023 16:28:20 +0200 Subject: [PATCH] Update account_map.sql --- cid/builtin/core/data/queries/shared/account_map.sql | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/cid/builtin/core/data/queries/shared/account_map.sql b/cid/builtin/core/data/queries/shared/account_map.sql index 2d056b50..25cea38f 100644 --- a/cid/builtin/core/data/queries/shared/account_map.sql +++ b/cid/builtin/core/data/queries/shared/account_map.sql @@ -1,10 +1,12 @@ CREATE OR REPLACE VIEW account_map AS SELECT ${account_id} AS account_id, - MAX_BY(${account_name}, concat(${account_name}, ': ', ${account_id})) AS account_name + (CASE + WHEN ${account_name} <> '' + THEN MAX_BY(concat(${account_name}, ': ', ${account_id}), concat(${account_name}, ': ', ${account_id})) + ELSE ${account_id} + END) AS account_name FROM ${metadata_table_name} -WHERE - ${account_name} <> '' GROUP BY ${account_id}