我正在尝试这样的事情:
result = db.GqlQuery("SELECT * FROM myDataMode COUNT(Employee) GROUP BY(Department) WHERE Salary > :1"10000)
我收到了错误:
BadQueryError: Parse Error: Expected no additional symbols at symbol count
任何人都可以帮助我。
答案 0 :(得分:5)
GQL不是SQL。它没有COUNT()
或GROUP BY()
。有关详细信息,请参阅GQL reference。
答案 1 :(得分:1)
由于GQL没有COUNT
和GROUP BY
功能。
所以我为它设计了一个解决方案:
result = db.GqlQuery( SELECT * form Employee)
从结果中创建一个具有唯一Departments的数组:
if result.Department not in array:
array.append(result.Department)
for department in array:
query = db.GqlQuery(SELECT * form Employee WHERE Department = :1,department)
print "In" + department + query.count() +"Employees are working"