5 Replies Latest reply: Dec 10, 2013 2:31 PM by marcin szuberla RSS

    How to flatten multiple records into a single record?

    marcin szuberla

      Hi,

       

      I have a problem that I am trying to answer and I am stuck.

      I have two tables: HEADER header DETAIL:

       

      HEADER:

      claim_id     net_payment    

      12345          24.59

       

      DETAIL:

      claim_id     diagnosis

      12345          A

      12345          B

      12345          C

      12345          D

       

      Is there a simple way to transform these two tables (HEADER and DETAIL), so that I get a table that looks like this?:

      SAMPLE_TABLE:

      claim_id     net_payment     Diagnosis_1     Diagnosis_2      Diagnosis_3     Diagnosis_4

      12345          24.59                  A                      B                      C                      D

       

      Any help is highly appreciated.

      Thank you in advance!!

       

      Marcin