在Google DataStore GQL中,如何对WHERE条款进行分组? [英] In Google DataStore GQL, how can I group the WHERE terms?

查看:113
本文介绍了在Google DataStore GQL中,如何对WHERE条款进行分组?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在WHERE子句中对术语进行分组.例如

I need to group terms in the WHERE clause. For example,

WHERE (param1='foo1' OR param1='foo2') AND (param2='bar1' OR param2='bar2')

但是它给了我一个语法错误,说括号是意外的".实际错误是:

But it's giving me a syntax error saying that the parentheses are "unexpected". The actual error is:

GQL query error: Encountered "(" at line 1, column 29. Was expecting one of: "false", "null", "true", <INTEGER>, <DOUBLE>, <SINGLE_QUOTE_STRING>, <DOUBLE_QUOTE_STRING>, <UNQUOTED_NAME>, <QUOTED_NAME>, <NAME_BINDING_SITE>, <POSITION_BINDING_SITE>

那么,我有什么办法可以运行该查询?

So, is there any way for me to run that query?

推荐答案

我相信您所面临的问题来自OR运算符-GQL没有一个运算符,因此您在括号中所具有的条件在语法上是不正确.

I believe the problem you're facing comes from the OR operator - GQL doesn't have one, so the conditions you have in the paranthesis are syntactically incorrect.

表的WHERE行中(强调我的):

From the WHERE row in the Clauses table (emphasis mine):

将结果集限制为满足一个或多个条件的实体 情况.每个条件都会将实体的属性与 使用比较运算符的值.如果多个条件结合在一起 使用 AND 关键字,则实体必须满足所有 查询要返回的条件. GQL没有OR .

Limits the result set to those entities that meet one or more conditions. Each condition compares a property of the entity with a value using a comparison operator. If multiple conditions are combined with the AND keyword, then an entity must meet all of the conditions to be returned by the query. GQL does not have an OR operator.

这篇关于在Google DataStore GQL中,如何对WHERE条款进行分组?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆