0

Assume the following table with notes

note_id    title   note_1    note_2    note_3    note_4    reason   user
------------------------------------------------------------------------
   1       A       foo       bar                 baz       XX       001
   1       A       foobar    bar                           YY       002
   1       A                                               ZZ       003
   2       B                           lorem               YY       004
   3       C       ipsum                                   GG       002
   3       C                 dolor                         KK       008
   4       D                                               BB       010
   4       D                                               XX       015

I am dealing with a table notes where a user can create an initial note (linked to a user), and then later link it to other user. Each note has 4 fields in the interface that can be filled in; there is no structure to whiich o the 4 is filled in when. The notes table does not have a unique id. The initial title never changes.

I now need to create an overview of all notes in the system, containing for each note_id the full data that we have on it, in 1 record per note, so:

note_id   title    notes                     reasons    users
-------------------------------------------------------------------
1         A        foo;bar;baz;foobar;bar    XX;YY;ZZ   001;002;003
2         B        lorem                     YY         004
3         C        ipsum;dolor               GG;KK      002;008
4         D                                  XX         015

How can I get this done?

Pr0no
  • 3,910
  • 21
  • 74
  • 121

0 Answers0