Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Group by a substring

584873Mar 16 2010 — edited Aug 24 2010
Hi 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
This post has been answered by Frank Kulash on Aug 21 2010
Jump to Answer

Comments

Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Sep 21 2010
Added on Mar 16 2010
14 comments
19,650 views