i have query gets public transport subscriptions. subscription can have multiple related companies. wanted query subscriptions , instead of creating row each time have related company, companies should group 1 column. possible that?
here's query :
select pts.id_publictransportsubscription, pts.amount, ptc.name bm_publictransportsubscriptions pts inner join bm_publictransportsubscriptionbycompany ptsbc on pts.id_publictransportsubscription = ptsbc.id_publictransportsubscription inner join bm_publictransportcompanies ptc on ptsbc.id_publictransportcompany = ptc.id_publictransportcompany i'm using sql server 2008.
you can use group_concat aggregate function.
Comments
Post a Comment