Selecting a result in one cell

How can I select the entire identifier for records in one cell?

For instance:

--example select of all values
select id, name, address, phone from table

And get the whole phone id, for example "% 555%", and show them in one field: '111 123 234 321 231 234'

+3
source share
1 answer

If you are using Oracle 11gR2:

select LISTAGG(id, ' ') WITHIN GROUP (ORDER BY id) from table

If you are not using Oracle 11gR2, check if the wm_concat function is available and follow these steps:

select wm_concat(id) from table

Keep in mind that you can combine these functions with group by clauses. Check out the link I gave you for more options.

+3
source

Source: https://habr.com/ru/post/1739148/


All Articles