Okay I used this SQL Script to join two tables but a certain amount of rows has to be joined with another table, here is how i did it with a join and union operation