java
java

Reputation: 1214

How to do <Enter> in SQL?

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.

Upvotes: 0

Views: 804

Answers (1)

Marco
Marco

Reputation: 23945

try \n:

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

Upvotes: 2

Related Questions