Home Ask Login Register

Developers Planet

Your answer is one click away!

java February 2016

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:



|| '
    ' ||

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.


Serv February 2016

try \n:

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

Post Status

Asked in February 2016
Viewed 1,793 times
Voted 4
Answered 1 times


Leave an answer

Quote of the day: live life