sql - Concat results from a query -


i want concat results query 1 string. how do it? here select query

select cast(mytable.totalamount varchar(100)) + ' ' + mytable.curr mytotal  from(select sum(oitem_total_amount) totalamount            ,unit_code_currency curr        t_ord_item        basket_id=230        group unit_code_currency     ) mytable 

here result set

4200.000000 cad 3735.000000 cny 19.200000 eur 19.922175 usd 

so want 4 results 1 string can display 1 field. like

4200.000000 cad <br/> 3735.000000 cny <br/> 19.200000 eur <br/> 19.922175 usd 

thanks in advance

sql fiddle

ms sql server 2008 schema setup:

create table test_table(value nvarchar(1000))  insert test_table values  ('4200.000000 cad'), ('3735.000000 cny'), ('19.200000 eur'), ('19.922175 usd') 

query 1:

select stuff((select '<br/> ' + value               test_table            --<-- use select query , table here               xml path(''),type).               value('.','nvarchar(max)'),1,6,'') list 

results:

|                                list                                        | |----------------------------------------------------------------------------| | 4200.000000 cad<br/> 3735.000000 cny<br/> 19.200000 eur<br/> 19.922175 usd | 

Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -