我习惯于在 Oracle 数据库上运行,所以我不太确定如何解决这个问题。我已将我的查询的一个简单示例缩小到以下内容:
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
子句的情况下运行查询。有任何想法吗?
--这是整个查询:
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