Q:

OData $filter with multiple predicates

If I have two entities in my model, "People" and "Addresses", and a particular Person has zero or more addresses, accessed via an AddressList navigation property, can I write an OData query that answers the following question:
"Which people have a last name ending in Smith and at least one address?"
It seems to me I can only do one predicate here, e.g.
http://localhost:55100/DemographicsDataService.svc/People?$filter=endswith(LastName,'Smith')
(I'm not yet convinced I can even write a $filter to handle the second predicate.. in which case, assume I'm trying to answer the question, "Last name ending in smith and first name starting with Mary")

A:

You can definitely combine predicates in the $filter. For example:
/People?$filter=endswith(LastName,'Smith') and startswith(FirstName,'Mary')

For details around supported operators and such please see this page: http://www.odata.org/documentation/odata-version-2-0/uri-conventions#FilterSystemQueryOption
Currently OData doesn't have a way to express the question "People which have at least one address".
Depending on your data it might be feasible to download all People fulfilling the first criteria and determine those with address on the client instead.

