An extreme multidimension Oracle Group By Select

Viewed 80

A conundrum I can't figure out

Giving these data in an Oracle table (named tbs_test). First row are column names

A  |B| C
100|6|1000
100|6|1001
100|6|1002
100|7|1003 **
200|6|2000
200|6|2001
300|7|3000
300|7|3001
400|6|4000 **
400|7|4001
400|7|4002

Through an Oracle SQL select I want to retrieve the two records marked with **.

The rules are:

  1. I'm interested in A=100 and A=400 because there are two different B's in the same A

    A=100 has B=6 and B=7

    A=400 has B=6 and B=7

  2. I'm interested in C=1003 because there are fewer B=7 (one) than B=6 (three) in A=100

    And I'm interested in C0 4000 because there are fewer B=6 (one) than B=7 (two) in A=100

Man, I'm troubled... Can anyone see the solution?

cheers Torsten

4 Answers
Related