Having this table (sorry, cant seem to get a decent layout here):
PD Header Text Mask_Producer Mask_Dep Mask_Diam
----------------------------------------------------------------------------------------------
10 Producer Aproducer Aprod * *
10 Producer Bproducer Bprod * *
20 Diam A Aprod 10 30
20 Diam A Aprod 20 40
20 Diam B Aprod 10 40
30 Dep 10 Aprod 10 *
30 Dep 20 Aprod 20 *
30 Dep 30 Aprod 30 *
20 Diam A Bprod 20 40
30 Dep 10 Bprod 10 *
I am using the rows in the table as a filter/mask for selecting other rows.
So, user having already made a selection of rows with:
PD Text
-------------
10 Aproducer
20 A
I would now like to find out what rows with PD=30 fits those previous choices:
PD=10, Text=Aproducer gives that Mask_Producer must be "Aprod", (Mask_Dep and Mask_Diam are allowed to be anything by the stars)
PD=20, Text=A gives that Mask_Producer must be "Aprod" and Mask_Dep must be 10 or 20 and Mask_Diam must be 30 or 40 (or star)
I want the outcome to be rows 6 and 7 from the table above.
Then imagine this example with 2000rows and 20 Mask_xx fields....
I am thinking SQL like IN, LEFT JOIN, JOIN, and temporary tables to do this, but I think I may be complicating things too much....