Where OrWhere Queries


(Merlin Diavova) #1

I managed to get a some cool queries working but I want to know is there a way to query a field and add a secondary where clause.

Thanks


(Pav) #2

You can add multiple Where clauses to the API Query function, but they are treated as AND statements, eg: array(‘FirstName’ => ‘Test’, ‘LastName’ => ‘Alpha’)

If you need to go to the level of having complex queries, it maybe a good idea to use the Saved Searches.

Otherwise, you will have to use the filtering in your code instead.


(Merlin Diavova) #3

Thank you for your reply, I meant to write for the same field. I’m currently using saved searches but just wanted to know if there was a way to achieve complex queues with API


(John Borelli) #4

You can’t customize the query in complex ways via the api. You can only set the complex query as a saved search and then pull the results of those criteria when you need them. ie there is no real equivalent to sending a SQL statement.


(Merlin Diavova) #5

Bummer! oh well thanks for your reply.


(Jerel lorenzo) #6

John is correct. However you can pull multiple queries then merge the arrays. Makes it more of a challenge