您应该在这里看到我正在尝试执行的操作,但是它不起作用
$getquery = "SELECT * FROM highscore WHERE score >= '$score' ORDER BY score ASC LIMIT 6 UNION SELECT * FROM highscore WHERE score < '$score' ORDER BY score DESC LIMIT 5";
mysql_error() 返回:“不正确地使用ORDER BY和UNION”。
mysql_error()
尝试:
$getquery = "(SELECT * FROM highscore WHERE score >= '$score' ORDER BY score ASC LIMIT 6) UNION ALL -- guaranteed to be beneficial in this case as Johan commented (SELECT * FROM highscore WHERE score < '$score' ORDER BY score DESC LIMIT 5)";
或查阅精美的手册。