I have a table (or rather a long join) with fields (id, name, prio) where I group over id
SELECT id, group_concat(name)
FROM my_table
GROUP BY id
Now I’d also like to have a column with the name of the lowest prio score. Like
SELECT id, group_concat(name), min(prio)
FROM my_table
GROUP BY id
but instead of having the minimum value of prio I’d like to see the corresponding ‘name’
Any idea?
I think you can make this a sub-query and then join it to the table something like: