Skip to main content
2 of 4
deleted 7 characters in body; added 139 characters in body
Martin Ho
  • 107
  • 1
  • 12

Omitting blank values in concatenation in SQL - Automation Studio

I want to concatenate some fields in one string with a comma as a delimiter, but want to omit the blank values.

MyDE

UNIQUE_ID BLOCK_ID1 BLOCK_ID2
A 1 2
B 1 2
C 1

When i do:

SELECT UNIQUE_ID,
CONCAT(BLOCK_ID1,', ', BLOCK_ID2) as BLOCK_ID
From My DE

OUTPUT DE:

UNIQUE_ID BLOCK_ID
A 1, 2,
B 1, 2,
C 1,

I want to remove the last comma from my output DE

Martin Ho
  • 107
  • 1
  • 12