1

我想要一个类似的条件

  • 开始时间 <= 开始时间输入 <= 结束时间
  • 或者
  • start_time <= end_time_input <= end_time
  • 或者
  • (start_time_input <= start_time AND end_time <= end_time_input )

文档中确定的 2 种方式(http://code.google.com/appengine/docs/python/datastore/queries.htmlhttp://code.google.com/appengine/docs/python/datastore/gqlqueryclass .html)据我了解是:

filter_trips = db.GqlQuery("SELECT key FROM Trips WHERE ( start_time <= :start_time_input AND end_time >= :start_time_input ) OR (start_time <= :end_time_input AND end_time >=:end_time_input ) OR ( start_time >= :start_time_input AND end_time <= :end_time_input )" , start_time_input = start_time_input , end_time_input = end_time_input )

错误:解析错误:符号处的 WHERE 标识符无效(

或者

filter_trips = db.GqlQuery("SELECT key FROM Trips WHERE start_time <= :start_time_input <= end_time OR start_time <= :end_time_input <= end_time OR (:start_time_input <= start_time AND end_time <= :end_time_input )" , start_time_input = start_time_input , end_time_input = 结束时间输入)

错误:解析错误:预计符号 <= 处没有其他符号

请帮忙!

4

1 回答 1

3

GQL 没有 OR。请参阅http://code.google.com/appengine/docs/python/datastore/gqlreference.html

您需要将其作为多个查询来执行。

于 2011-05-21T21:52:35.753 回答