I think, it'll be easier to help you if you provide reproducible example. Please have a look at this guide, to see how to create one:
In general, problems like yours can be solved with using appropriate join.