I don't know if this has been asked here. I saw couple of questions on "like" operator but I'm not sure if that's I'm looking for. Sorry I'm a noob at this. But I am moving from MySQL to Google App Engine and was wondering if there was an OR operator in GQL similar to ones in MySQL.
Basically what I am trying to achieve is get the login on name via their username or email address. So my query would be something like this.
query = db.GqlQuery("SELECT * FROM mytable
where username = :name
OR email = :email
AND password = :password",
name = user,
email = email,
password = pass1)
I realize that I can perform two queries and check each query for their successful completion and be able to achieve this but I am just wondering if there is already one available in GQL.
Thanks.
You can't do
OR
withGQL
; it only supportsIN
that you can see as a limited form ofOR
for a specific property.Like you've already said, your only option is to execute two different queries and combine the results.
If your language of choice is Java, have a look to the Query.CompositeFilter which you can use to construct a filter using the
OR
operator.