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)
精彩评论