I have three Oracle database tables. I'll create a contrived example to make it a little easier:
A table of veterinarians ..
vid name
1 Bob
2 Sally
3 Sue
4 Henry
Specialties
spid Animal
1 Dogs
2 Cats
3 Mice
4 Kangaroos
5 Koala Bears
Advertising
id vid spid Ad venue
1 1 1 TV ads
2 1 2 TV ads
3 1 2 Magazine ads
4 2 1 TV ads
5 2 1 On line ads
6 3 5 TV ads
7 4 5 Magazine ads
I'd like to get a result set of the first 3 vets that advertise just one speciality, for each specialty. It is possible that for some specialties, NO vet just advertises that one speciality. The 'vets' table has about 30,000 rows in it. The Specialties table just has 10 rows. The advertising table has about 100,000 rows. I know how to do queries and joins, but don't have an idea for how to find rows that are all the same within the group.
So I'm looking for output like this:
Dogs null
Cats Sally
Mice null
Kangaroos null
Koala Bears Sue, Henry