LAE

Welcome to the LAE community!  Please feel free to start a discussion in the discussion tab or join in a conversation.

Discussions

Members

Resources

Events

 View Only
  • 1.  convert data specified over rows into one row

    Employee
    Posted 03-12-2015 05:04

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: dhrobertson

    Hi all,

    essentially I need to do the following:

    I have a bunch of meetings where different products were discussed. 1 meeting could have had 3 products discussed and in the table I have, that is represented by 3 rows of the same meetingID followed by the name of the product in each case. what I want to get to is 1 row of data with 1 instance of the meetingID and each product listed on the same row. one meeting will not always discuss the same number of products.

    I'm assuming I will need to do some sort of loop with a Do While of something like that but not sure the best way of doing it...
    this is some dummy code to highlight what I'm trying to achieve:

    input:
    meetingID:string, Product:string
    meeting1,honda
    meeting1,ford
    meeting1,mazda
    meeting2,toyota
    meeting2,honda
    meeting3,mercedes
    meeting4,mazda
    meeting4,ford
    meeting4,toyota


    the output I'm looking for is:

    MeetingID Product1 product 2 product 3
    meeting1 Honda ford mazda
    meeting2 Toyota Honda null
    meeting3 Mercedes null null
    meeting4 mazda ford Toyota


    thanks for the help guys!

    regards

    douglas


  • 2.  RE: convert data specified over rows into one row

    Employee
    Posted 03-12-2015 05:35

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: ryeh

    Create a new field labeling the product numbers. Then pivot. See attached.
    Attachments:
    pivot.brg


  • 3.  RE: convert data specified over rows into one row

    Employee
    Posted 03-12-2015 06:33

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: dhrobertson

    thank you,

    that is exactly what I'm after.... thanks very much

    doug