我習慣在Oracle數據庫上運行,所以我不太確定如何解決這個問題。我已經收窄我的查詢的一個簡單的例子如下:MySQL錯誤1064(v 5.0.96)GROUP BY子句
SELECT 0 as gm_rowID,
'-ALL Grantmakers-' as grantmakerName
FROM dual
GROUP BY 2
phpMyAdmin的運行,出現以下錯誤的SQL:
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'ORDER BY 2 LIMIT 0, 30' at line 1
Oracle可以運行此查詢就好了。 MySQL可以在沒有GROUP BY
子句的情況下運行查詢。有任何想法嗎?
--Here是整個查詢:
SELECT
p.grantmaker_rowid as gm_rowID,
gm.grantmaker_companyName as grantmakerName
FROM grantmaker_info gm, proposal_submission p
WHERE 0=0
AND p.grantmaker_rowid = gm.grantmaker_rowid
UNION
SELECT
0 as gm_rowID,
'-ALL Grantmakers-' as grantmakerName
FROM dual
ORDER BY 2
GROUP BY 2
LIMIT 0 , 30
請顯示整個查詢。 –
@Chester:仍然不可能是整個查詢,因爲(至少)它缺少'GROUP BY'和'LIMIT'子句。 – eggyal