Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
FernandaNava
Partner - Contributor III
Partner - Contributor III

Merging rows with same ID on non-null fields

I have a table in which the an ID appears several times, but for each, there's only one field that is not null: 

IDStage1DateStage2DateStage3Date
101-01-2020--
1-01-02-2020-
1--01-03-2020

 

Is there a way in which I could merge these into a single row?

 

PS.  I built this table from another one that looked like this:

IDChangeDateInitialStageFinalStage
101/02/202012
101/03/202023

 

Therefore, if this could be solved more easily by changing the way the table is constructed I could do it too.

 

Thank you 

Labels (2)
1 Solution

Accepted Solutions
klikgevoel
Contributor III
Contributor III

If I understand you correctly you want one row with the Stage*Date variables, i.e.

IDStage1DateStage2DateStage3Date
101/01/202001/02/202001/03/2020

 

This can be achieved via Left Join prefix and Where clause.

Example

Data:

LOAD

ID,

Stage1Date

From DataSource

Where Not IsNull(Stage1Date);

 

Left Join(Data)

LOAD

ID,

Stage2Date

From DataSource

Where Not IsNull(Stage2Date);

etc.

See attachment for little explanation and example.

View solution in original post

1 Reply
klikgevoel
Contributor III
Contributor III

If I understand you correctly you want one row with the Stage*Date variables, i.e.

IDStage1DateStage2DateStage3Date
101/01/202001/02/202001/03/2020

 

This can be achieved via Left Join prefix and Where clause.

Example

Data:

LOAD

ID,

Stage1Date

From DataSource

Where Not IsNull(Stage1Date);

 

Left Join(Data)

LOAD

ID,

Stage2Date

From DataSource

Where Not IsNull(Stage2Date);

etc.

See attachment for little explanation and example.