GEOT-4229 fix join of more than two tables

Fixes mismatch while retrieving attributes from joins with more than two tables.