Group by a substring
584873Mar 16 2010 — edited Aug 24 2010Hi All,
Oracle 11.2.0
I have the following table, is there a way I can get the average age of all the names with LN:SMITH.
In other words I want to regexp parsing and grouping using sql
create table test_table (
age number,
names varchar2(500));
insert into test_table (age,names) values(20,'FN:John,LN:Smith');
insert into test_table (age,names) values(30,'FN:Sam,LN:Blair');
insert into test_table (age,names) values(40,'FN:Will,LN:Smith');
insert into test_table (age,names) values(50,'FN:Sam,LN:Smith');
insert into test_table (age,names) values(60,'FN:Peter,LN:Lloyd');
insert into test_table (age,names) values(70,'FN:John,LN:Blair');
insert into test_table (age,names) values(80,'FN:Ann,LN:Smith');
Thanks in advance
__Pete