complete join query (rough)