开发者

OR Condition Return Error in GQL ( Google app engine) Why?

When i use the OR condion in GQL it return error messege tht "BadQueryError: Pars开发者_开发技巧e Error: Expected no additional symbols at symbol OR . Why?

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 clearly says that GQL doesn't have an OR operator..

You could do something like this ..Make two queries and combine the results...

  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)
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜