I would strongly suggest you draw a data model (entity-relationship or whatever) for these tables. I suspect you have started off on the wrong foot and a diagram should help you clarify the situation. Then start to put it together one table at a time.

(Check that you have the (+) on the correct side of the conditions. Some of your conditions look suspect to me, though it's hard to tell without knowing your application.)