How do I query the AppEngine DB comparing two properties of the same entity?
I'd like to make a query to return all the entities of a given type where one property is greater than anot开发者_如何转开发her. For example, return all Widgets where selling price is greater than buying price. I can't seem to figure out how to do it in the Google AppEngine datastore.
You can't do this directly, because the indexing model does not support complex expressions like that. You'll have to add a new property that you manually maintain as the difference between buying and selling price, then search for items where this delta property is greater than or less than zero.
精彩评论