当我在GQL中使用OR条件时,它返回错误消息“ DbQueryError:解析错误:在符号OR处不应包含其他符号。为什么?
db.GqlQuery("Select * from vendor where access='public' OR organisation_id='"+ orgid +"'")
最佳答案
GQL does not have an OR operator. However, it does have an IN operator,
which provides a limited form of OR.
Docs明确表示GQL没有OR运算符。
你可以做这样的事情..进行两个查询并合并结果...
vendors=vendor.all()
pub_vendors = vendors.filter("access = ","public")
vendors=vendor.all()
org_vendors = vendors.filter("organisation_id = ",orgid)
results = pub_vendors.extend(org_vendors)