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...
TIME_BUCKET group by time period
-
We all know how to sum up by year select
to_char(trunc(hiredate,'Y'),'YYYY') year, count(*) from scott.emp group by
trunc(hiredate,'Y') order by trunc(hire...
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