TO my understanding, there is no single WHERE clause you can apply to accomplish what you want. You might end up with two queries: first to filter the related table based on its where clause; once returned, use its result to query the feature layer based on the related record ids and the where clause for the feature layer. Then you can process the result the way you like. Don't try to query the feature layer first; otherwise, you will end up with more queries.require([ "esri/tasks/Query", "esri/tasks/QueryTask", "esri/tasks/RelationshipQuery" ], function(Query, QueryTask, RelationshipQuery) { var queryTask = new QueryTask("related data url"); var query = new Query(); query.where = "where clause to filter the related data"; queryTask.executeForIds(query,function(relDataIds){ var relQuery = new RelationshipQuery(); relQuery.definitionExpression = "where clause to filter the feature"; relQuery.objectIds = relDataIds; relQuery.relationshipId = 3; relQuery.returnGeometry = true; queryTask.executeRelationshipQuery(relQuery, function(featureSet) { // do whatever you like to process the final result }); }); });