I have the following table structure for storing activity items
id, trackable_id, trackable_type, owner_id, owner_type
where trackable_id and trackable_type tells me on what object(entity) the action is performed on. For example if a User with id=1 likes a Picture with id=1
id, trackable_id, trackable_type, owner_id, owner_type
1, 1, Picture, 1, User
Similarly another user can like the same picture. In my news feed, I can easily display the activities performed by the users, however I would like to achieve something like this:
John and katy likes Picture.
instead of
John likes Picture
Kay likes Picture.
I guess the way to go is to do a group by based on trackable_id and trackable_type but it returns me one row(expected result of group by). I have not used group_concat before, does it help in this kind of situation? Thanks!