hmmm, pretty wide open topic here. Let's define (clarify) some key elements first so I can try and give you a hand.
1. Please provide me with some table definitions. Table name and the fields for each.
2. What exactly are you trying to accomplish. Just an understanding so I understand what your goal is please.
That should help me get an idea of where to go with the assistance...