0

it's a noob question so hope somebody can help on this

I want to transform the resultset from the query which has a multiple lines for one user to a single row of data for one activity

i get this data

userid, date,      activity_id, parameter_id,   parameter_value
545,  2011/9/11,  1,    4, 20
545,    2011/9/11,  1,  5, 10,
545,  2011/9/11,  1,  6, 30,

i want it to convert to

userid, date,   activity_id,  parameter_4_id_value, parameter_5_id_value, parameter_6_id_value
545,    2011/9/11,  1, 20,10,30

any example will be really helpful. Thank you

Oldskool
  • 34,211
  • 7
  • 53
  • 66
ikta
  • 1
  • 1

1 Answers1

0

If you are talking about pulling data from MySQL you can use GROUP_CONCAT to do something like this. See this other answer for an example https://stackoverflow.com/a/276949/511203

Community
  • 1
  • 1
Mike Gorski
  • 1,228
  • 1
  • 8
  • 13