How can i transpose this table? | Community
Skip to main content
Level 2
February 4, 2020
Solved

How can i transpose this table?

  • February 4, 2020
  • 1 reply
  • 2842 views

 

ID  FirstName LastName Email

1   Name1       Name12    Email1

2   Name2       Name22    Email2

3   Name3       Name32    Email3

 

i want to convert above table into

 

ID   AttributeName   AttributeValue

1     FirstName        Name1

1     LastName        Name12

1     Email                Email1

2     FirstName        Name2

2     LastName        Name22

2     Email                Email2

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Jonathon_wodnicki

Hi,

 

Repeat insert statements for each of your cols:

  • insert into new_eav_table (ID, AttributeName, AttributeValue)
    select ID, 'FirstName', FirstName from old_table
  • insert into new_eav_table (ID, AttributeName, AttributeValue)
    select ID, 'LastName', LastName from old_table
  • insert into new_eav_table (ID, AttributeName, AttributeValue)
    select ID, 'Email', Email from old_table 

 

You can also do this with select->update->update->update in a workflow.

 

Thanks,

-Jon

1 reply

Jonathon_wodnicki
Community Advisor
Jonathon_wodnickiCommunity AdvisorAccepted solution
Community Advisor
February 4, 2020

Hi,

 

Repeat insert statements for each of your cols:

  • insert into new_eav_table (ID, AttributeName, AttributeValue)
    select ID, 'FirstName', FirstName from old_table
  • insert into new_eav_table (ID, AttributeName, AttributeValue)
    select ID, 'LastName', LastName from old_table
  • insert into new_eav_table (ID, AttributeName, AttributeValue)
    select ID, 'Email', Email from old_table 

 

You can also do this with select->update->update->update in a workflow.

 

Thanks,

-Jon

Level 2
February 5, 2020
Appreciate it. I am trying to do this with workflow. Anyway to do this with workflow enrichment?