Fix when joining tables for SQL join clause.