Changed join column in SQL statement

@huwr Please look.