0

How to display data in reverse order using sql query?

Suppose I have stored the data in the name column as "S B" , I want to display the data as "B S" using SQL query. Another example : "Dan Brown" original data , displayed data "Brown Dan". The first name and the last name are not stored in separate columns therefore I am not able to understand how to accommodate the spaces. Also I want to make this query generic , so want to add provisions for middle name , if any. I have thought of something like : SELECT SUBSTR( )||" "||( )... How do I start reading from the end of the string and accommodate the spacing? I am using Oracle sql (live).

7th Sep 2019, 2:34 PM
Sreyashi Bhattacharjee
1 Respuesta
+ 1
Why? Just do it after the data is fetched. Split it into array and loop it backwards.
7th Sep 2019, 10:59 PM
Toni Isotalo
Toni Isotalo - avatar