0

I want to pair together two texts from two tables with the Enter character between them.

What I did so far is:

select text1 || '
' || text2
from A
join B u
using (id)

For example if: text1='Hello' and text2='World'

it will give:

Hello
World

the

|| '
    ' ||

gives the Enter key. Is there another way to do it something like ascii code or what ever? It feels stiuped to do it this way.

Note: This is PoostgreSql question. I initially tagged it this way. Answers from SQL SERVER does not apply here.

java
  • 1,124
  • 2
  • 14
  • 33

1 Answers1

2

try \n:

select text1 || E'\n' || text2
from A
join B u
using (id)
Marco
  • 22,856
  • 9
  • 75
  • 124