SA0001: Fixed wrong SQL query