1
當我使用OR condion在GQL它返回錯誤messege謂「BadQueryError:解析錯誤:預期在符號或沒有其他符號爲什麼或GQL中的條件返回錯誤(Google應用程序引擎)爲什麼?
db.GqlQuery("Select * from vendor where access='public' OR organisation_id='"+ orgid +"'")
當我使用OR condion在GQL它返回錯誤messege謂「BadQueryError:解析錯誤:預期在符號或沒有其他符號爲什麼或GQL中的條件返回錯誤(Google應用程序引擎)爲什麼?
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.
文件明確指出,GQL沒有按」?噸有一個OR操作..
你可以做這樣的事情..Make兩個查詢併合並結果...
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)
你的例子將是AND,而且幾乎可以肯定不是OP想要的。 – geoffspear 2011-06-02 22:53:11
@Wooble ..編輯答案..嗯......這是一個很大的錯誤 – 2011-06-03 05:01:47
如果供應商有一個日期時間屬性,我將如何按時間排序'結果'使用GQL(通常使用'ORDER BY time ASC/DESC')?除非有一個漂亮的技巧,編程方式似乎不必要的複雜 – benjammin 2012-07-24 08:42:19