0

So I have this example pretty simple data in mysql

table Reporting

   user_id  |campaign_id | action_type | date_time  |
        R12 |    T4      |   message   | 2018-02-03 |
        R12 |    T4      |    call     | 2018-05-09 |

I want it to display the output of select query like this :

 user_id|campaign_id | message_date_time | call_date_time |
  R12   |  T4        |      2018-02-03   |  2018-05-09

How to query this table data to make the output like above? any help would be very appreciate .Thank you

Satria stuart
  • 93
  • 4
  • 12
  • `.. ever exist group by` what? ... group by what? – ArtisticPhoenix Apr 12 '18 at 14:17
  • This transformation is called pivoting and has been asked and answered here on SO soooo many times. The duplicate topic shows you how to do this in MySQL step-by-step. However, pls not that it may be more efficient to perform this transformation in the application code. – Shadow Apr 12 '18 at 14:21
  • @ArtisticPhoenix it is possible to do this purely in MySQL, even if the action type is a long, dynamic list. Whether you truly want to implement it purely in MySQL, that's a different question. – Shadow Apr 12 '18 at 14:22
  • yes I want to implement it in MySQL,can you please tell how to make output like that ? – Satria stuart Apr 12 '18 at 14:29

0 Answers0