This blog is mostly focused on the technical aspect of data mining.
Monday, December 17, 2018
Remove the Last Word From a String Using Oracle SQL
I use the following query to remove the last word of a sentence.
with tbl as (select 'Boston city' as name from dual)
select name, substr(name, 1, instr(name,' ',-1)-1 ) simple_name from tbl;
NAME SIMPLE_NAME
----------- -----------
Boston city Boston
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.