MySQL: sortowanie grup wartości CONCAT
W skrócie: czy jest jakiś sposób na sortowanie wartości w instrukcji GROUP_CONCAT?
Zapytanie:
GROUP_CONCAT((SELECT GROUP_CONCAT(parent.name SEPARATOR " » ")
FROM test_competence AS node, test_competence AS parent
WHERE node.lft BETWEEN parent.lft AND parent.rgt
AND node.id = l.competence
AND parent.id != 1
ORDER BY parent.lft) SEPARATOR "<br />\n") AS competences
I get this row:
Rzemiosło " Stolarstwo
Administracja " Organizacja
Chcę tak:
Administracja " Organizacja
Rzemiosło " Stolarstwo
155
2 answers
Zobacz http://dev.mysql.com/doc/refman/...tions.html#function_group-concat :
SELECT student_name,
GROUP_CONCAT(DISTINCT test_score ORDER BY test_score DESC SEPARATOR ' ')
FROM student
GROUP BY student_name;
330
Author: Sampson,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2009-06-15 14:09:30
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2009-06-15 14:09:30
Chcesz zamówić przez?
SELECT _key,
COUNT(*) as cnt,
GROUP_CONCAT(_value ORDER BY _value SEPARATOR ', ') as value_list
FROM group_concat_test
GROUP BY _key
ORDER BY _key;
18
Author: Haim Evgi,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2015-01-15 18:12:01
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2015-01-15 18:12:01