Mysql Set Variable For Inner Join Select Query