How can I get all results concatenated from a column group by UID?
2
votes
1
answer
119
views
I need to build a SQL query, for MySQL 5.7, if it is possible, to "
GROUP BY
" uid
and title
and concat the permissions
column and separate with a |
? I am saying GROUP BY
but I do not know if that is the right term here.
+------+--------+------------------------------------------------+
| uid | title | permissions |
+------+--------+------------------------------------------------+
| 1438 | Delete | /_permission_set.php|/process.php|/command.php |
+------+--------+------------------------------------------------+
| 1438 | Remove | /_permission_set.php|/process.php|/command.php |
+------+--------+------------------------------------------------+
I have tried the following SQL (as you can see in this DBFiddle ) but it did not work
SELECT uid, CONCAT('|', permissions)
FROM some_table
WHERE uid=1438
GROUP BY uid, permissions;
Asked by ReynierPM
(1888 rep)
Jun 25, 2024, 01:05 AM
Last activity: Jun 25, 2024, 04:54 AM
Last activity: Jun 25, 2024, 04:54 AM