Problem:
The values in a column "Location" of your table are as follows:
Location
---------------
asw-qwer-sdf
bnm-sdr
cbn-hyt-opu
Write a query to retun the values as :
Location
-------------
aswQwerSdf
bnmSdr
cbnHytOpu
Solution:
select
location,
substr(location,1,instr(location,'-',1,1)-1)^^replace(initcap(substr(location,instr(location,'-',1,1)+1)),'-','')
from
sales
* replace ^^ by pipes...due to some printing issues pipes are not being displayed...
return code before grep
-
my 2009 solution return code before grep ( ( ( mycmd echo $? >&3 ) |grep
mytext >&4 ) 3>&1 |(read x;exit $x) )4>&1 my 2025 solution mycmd > >(grep
mytext)
1 week ago
1 comment:
This is almost similar to ur query
select replace(substr(location,1,instr(location,'-')-1)||initcap(substr(location,instr(location,'-'))),'-','') Done from conversion
Cheers
Kartik
Post a Comment