Hi,

I have the following model of Users and I want to get all the users
that like 'yellow', but don't like 'red'.

    class User(db.Model):
        name = db.StringProperty(required=True)
        favorite_colors = db.StringListProperty(required=True)

This works (all users that have at least one favorite color 'yellow'
are returned):

    results = db.GqlQuery(
        "SELECT * FROM User "
        "WHERE favorite_colors = 'yellow'")

But this does not do what I expected:

    results = db.GqlQuery(
        "SELECT * FROM User "
        "WHERE favorite_colors = 'yellow' "
        "and favorite_colors != 'red'")

The same list of users is returned. I believe that it's testing if any
of the favorite colors are different from 'red' and not if the list
does not contain 'red' at all.

How can I filter only the results that contain an item and not another
one?

--

You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.


Reply via email to