How to get only the last name by using SQL Query?
Asked
Active
Viewed 218 times
-2
-
2What [tag:rdbms] are you using? – Mureinik Jun 22 '17 at 09:34
-
please provide the database you are using – Rajat Mishra Jun 22 '17 at 09:34
-
What have you tried do far? We are not here to do your Job! – Jens Jun 22 '17 at 09:34
-
Considering the ambiguous nature of the question, you might want to check the answers on the following post which will likely lead you to a solution. https://stackoverflow.com/questions/19006692/extract-characters-to-the-right-of-a-delimited-value-in-a-select-statement – Brien Foss Jun 22 '17 at 16:56
1 Answers
1
If you are using an oracle rdbms, then you can use substr
and instr
functions to get the lastname from the column
.
For ex.
Select substr(column_name, instr(column_name,".")) from the table_name
Note:- Assumed that dot (".") is present only once in the values.
For more reference you can refer instr documentation and substr documentation

Rajat Mishra
- 3,635
- 4
- 27
- 41