Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
mmainiero
Contributor II
Contributor II

Merge 2 Fields from one table

Hi,

I would like to merge some phone numers from three fields into one.

What I have:

Data:

Customer

Private_phone

Work_phone

other_phone

change_date

Orders

What I want:

Customer

phone_numers

change_date

orders

The above fields with all phone numbers should lead to a row for each number.

Thanx

1 Solution

Accepted Solutions
sunny_talwar

May be this

Data:

LOAD Customer,

     Private_phone as phone_numbers,

     'Private' as Phone_type,

     change_date,

     orders

FROM ....;

Concatenate (Data)

LOAD Customer,

     Work_phone as phone_numbers,

     'Work' as Phone_type,

     change_date,

     orders

FROM ....;

Concatenate (Data)

LOAD Customer,

     other_phone as phone_numbers,

     'Other' as Phone_type,

     change_date,

     orders

FROM ....;

View solution in original post

5 Replies
sunny_talwar

May be this

Data:

LOAD Customer,

     Private_phone as phone_numbers,

     'Private' as Phone_type,

     change_date,

     orders

FROM ....;

Concatenate (Data)

LOAD Customer,

     Work_phone as phone_numbers,

     'Work' as Phone_type,

     change_date,

     orders

FROM ....;

Concatenate (Data)

LOAD Customer,

     other_phone as phone_numbers,

     'Other' as Phone_type,

     change_date,

     orders

FROM ....;

mmainiero
Contributor II
Contributor II
Author

Is there an solution where I not have to load the table 3 times?

sunny_talwar

May be use CrossTable()

The Crosstable Load

sunny_talwar

Something like this

Data:

CrossTable(Phone_type, phone_numbers, 3)

LOAD Customer,

     change_date,

     Orders,

     Private_phone,

     Work_phone,

     other_phone

Resident ...;

Learnerr
Contributor III
Contributor III

Hi,

I extract data from SQL.

In the Select section i have 2 fields called "Explanation" and "Group". 

In the LOAD part i would like to combine both fields as they have similar parts within them. I wrote LOAD part like this:

LOAD Distinct

Explanation& Group as Groups

 

When i run this code in the front i create a listbox with the Field of "Groups" but it brings me double things under it.

Such as : Explanation and Group contains a field called linkedin and it shows in the list box as LinkedinLinkedin.

What can i do to prevent that double thing?

Thanks in advance.

Kind Regards.

 

(Then,

I wrote my code like this but it doesnt work:

 

CONCATENATE

Table:
Load Distinct
MenuId,
Explanation as Groups,

Group as Groups


;
SELECT
MenuId,
Explanation,
Group

FROM XYZ

)