php - Modifying CONCAT display -
i learned how use concat function in database query. works great, i'm trying figure out how modify display.
in reference table, have displays this: japan,arizona
i'd insert space after comma , display names alphabetically, this:
arizona, japan
i inserted secondary order command @ end of query, doesn't anything. also, possible insert hyperlinks in individual names in concat string? example:
<a href="/world/arizona" title="arizona">arizona</a>, <a href="/world/japan" title="japan">japan</a>
below query...
select plan.latin latin2, plan.common, plan.group1, plan.rank, plan.family, plan.order1, gs.symbol, gs.latin, group_concat(gg.name) names, gg.idparent gs_planimals plan left join gs gs on gs.latin = plan.latin left join gw_geog gg on gg.idarea = gs.idarea plan.group1 = :refcat , rank != '55' group plan.common order plan.n, gg.name
group_concat
takes optional arguments of order by
, separator
, so:
select plan.latin latin2, plan.common, plan.group1, plan.rank, plan.family, plan.order1, gs.symbol, gs.latin, group_concat(gg.name order gg.name asc separator ', ') names, gg.idparent gs_planimals plan left join gs gs on gs.latin = plan.latin left join gw_geog gg on gg.idarea = gs.idarea plan.group1 = :refcat , rank != '55' group plan.common order plan.n, gg.name
Comments
Post a Comment