Joined: 23 Nov 2006 Posts: 19270 Location: Inside the Matrix
It appears that the sample data does not contain examples of all of the rules (or i've misunderstood something ). . .
Please review the sample input from the 2 tables and add/change anything as you determine necessary. Please practice with Preview before clicking Submit - Preview lets you see your post as it will appear to the forum rather than how it appears in the Reply editor.
Once you have verified the input is as you want, please post the expected output that would be selected by this query from the sample input posted.