Filling a table from 2 other tables

I think it's related here: