Skip to main content
added 58 characters in body
Source Link
Martin Ho
  • 107
  • 1
  • 12

I am trying to concatenate BLOCK_ID1 and, BLOCK_ID2 and BLOCK_ID3 into one string in BLOCK_ID. I want to remove the last comma in the string.

MyDE

 
UNIQUE_ID BLOCK_ID1 BLOCK_ID2BLOCK_ID3
A 1 2 3
B 1 2
C 1 

When i do:

SELECT UNIQUE_ID,
CONCAT(BLOCK_ID1,', ', BLOCK_ID2, ', ', BLOCK_ID3) as BLOCK_ID
From MyDE

OUTPUT DE:

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

I want to remove the last comma from B and C

I am trying to concatenate BLOCK_ID1 and BLOCK_ID2 into one string in BLOCK_ID. I want to remove the last comma in the string.

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 MyDE

OUTPUT DE:

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

I want to remove the last comma from C

I am trying to concatenate BLOCK_ID1, BLOCK_ID2 and BLOCK_ID3 into one string in BLOCK_ID. I want to remove the last comma in the string.

MyDE

 
UNIQUE_ID BLOCK_ID1 BLOCK_ID2BLOCK_ID3
A 1 2 3
B 1 2
C 1 

When i do:

SELECT UNIQUE_ID,
CONCAT(BLOCK_ID1,', ', BLOCK_ID2, ', ', BLOCK_ID3) as BLOCK_ID
From MyDE

OUTPUT DE:

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

I want to remove the last comma from B and C

deleted 7 characters in body; added 139 characters in body
Source Link
Martin Ho
  • 107
  • 1
  • 12

Omitting Remove comma if field is a blank valuesvalue in concatenation in SQL - Automation Studio

I wantam trying to concatenate some fields inBLOCK_ID1 and BLOCK_ID2 into one string with a comma as a delimiter, butin BLOCK_ID. I want to omitremove the blank valueslast comma in the string.

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 DEMyDE

OUTPUT DE:

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

I want to remove the last comma from my output DEC

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

Remove comma if field is a blank value in concatenation in SQL - Automation Studio

I am trying to concatenate BLOCK_ID1 and BLOCK_ID2 into one string in BLOCK_ID. I want to remove the last comma in the string.

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 MyDE

OUTPUT DE:

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

I want to remove the last comma from C

deleted 7 characters in body; added 139 characters in body
Source Link
Martin Ho
  • 107
  • 1
  • 12

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

MyDE | UNIQUE_ID | BLOCK_ID1 | BLOCK_ID2 | |:---- |:------:| -----:| | A | 1 | 2 | | B | 1 | 2 | | C | 1 | |

UNIQUE_IDBLOCK_ID1BLOCK_ID2
A12
B12
C1

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, |

UNIQUE_IDBLOCK_ID
A1, 2,
B1, 2,
C1,

I want to remove the last comma from my output DE

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

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

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

MyDE

UNIQUE_IDBLOCK_ID1BLOCK_ID2
A12
B12
C1

When i do:

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

OUTPUT DE:

UNIQUE_IDBLOCK_ID
A1, 2,
B1, 2,
C1,

I want to remove the last comma from my output DE

Source Link
Martin Ho
  • 107
  • 1
  • 12
Loading