Fix join statement