Fixing join query for PAIS