postgresql - Add URL to aggregated variable SQL -
i join 2 sql tables (applications, areas_application1) , group area. in first table have columns url_title , url_link. want display eah area list of url_title 's , add href link each title. tried aggregate url_title space, don't know how aggregate url_link each url_title. version not work.
select app.area, ar.cartodb_id, count(app.area), array_to_string(array_agg(app.url_title), '<a href="app.url"</a><br />'), ar.the_geom_webmercator applications app join areas_application1 ar on ar.name = app.area group app.area, ar.the_geom_webmercator, ar.cartodb_id
following query should help:
select app.area, ar.cartodb_id, count(app.area), array_to_string(array_agg('<a href="'||app.url_link||'">'||app.url_title||'</a>'), ' '), ar.the_geom_webmercator applications app join areas_application1 ar on ar.name = app.area group app.area, ar.the_geom_webmercator, ar.cartodb_id;
Comments
Post a Comment