Separator in group_concat #638
-
Hello ! |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 6 replies
-
Hi, If you want to escape characters, you have to use backslashes i.e. Otherwise, something like that works for me with SQLite (3.46): SELECT GROUP_CONCAT(foo, CHAR(10)); Which database are you using? |
Beta Was this translation helpful? Give feedback.
-
Hello ! You need to use markdown if you want to create multiple paragraphs of text. The following will output select
'foldable' as component;
select
'The foldable component' as title,
'
a
b
c
d' as description; but the following will create multiple paragraphs, the way you want: select
'foldable' as component;
select
'The foldable component' as title,
'
a
b
c
d' as description_md; (description_md instead of description) |
Beta Was this translation helpful? Give feedback.
-
Hi, |
Beta Was this translation helpful? Give feedback.
-
-- Fiches
select
'columns' as component WHERE $tab=1;
select
--(SELECT pole from poles WHERE poles.id=pole_id) as title,
'tools' as icon,
group_concat(distinct nom,
CHAR(10) || CHAR(10)) as description_md,
json_group_array(json_object('icon','tools','color','red','description',categorie)) as item,
entreprise as button_text
from inscription LEFT JOIN besoins on inscription.id=besoins.inscription_id LEFT JOIN services on services.id=besoins.categorie_id JOIN intervenants on inscription.id=intervenants.inscription_id WHERE $tab=1 GROUP BY inscription.id; You can see what i want to build at https://forum.college-bourrillon.fr/besoins.sql |
Beta Was this translation helpful? Give feedback.
Oh, I see. the problem comes from group concat not allowing the use of both DISTINCT and a custom separator. You can replace
with a subquery that does the de duplication separately. Something like