title: Swift Parse PFQuery filter tableA and filter pointer tableB
body: <p>here’s my concern:</p>
  
  <p>I have a table A which contains a set of properties including a location property (FYI, no pointers in the table)
  I have a table B which contains a set of properties and a pointer pointing to a unique object in table A (using the table A objectId property). There may be a same pointer for several objects in table B.
  So basically, each object in table A has several objects pointing to it from table B.</p>
  
  <p>What I’m trying to achieve is to filter all elements from table A within a certain location using: (please note generic names in the code examples)</p>
  
  <pre><code>let queryA = PFQuery(className: "tableA")
  queryA.whereKey("location", nearGeoPoint: location, withinMiles: 5)
  </code></pre>
  
  <p>which works fine, and then to get all elements from table B pointing to the filtered elements .. and here is a first problem, because table A has no pointers, there seem to be no way to achieve this directly from table A, is there ?</p>
  
  <p>So what I’ve tried is start filtering all objects in table B according to the filtered objects from table A, which led me to:</p>
  
  <pre><code>// Filtering all objects in table A according to a specific PFGeoPoint.
  let queryA = PFQuery(className: "tableA")
  queryA.whereKey("location", nearGeoPoint: location, withinMiles: 5)
  
  // Filtering all elements in table B according to filtered elements from table A
   let queryB = PFQuery(className: "tableB")
   queryB.includeKey("pointer")
   queryB.whereKey("pointer", matchesKey: "objectId", in: queryA) 
  
  // and then fetch the objects
  queryB.findObjectsInBackground() { objects, error in
  print(objects)
  }
  </code></pre>
  
  <p>which doesn’t work because it seems that matchesKey must be operating under the same class.</p>
  
  <p>I’ve then tried to find all objects from table A within a certain location using queryA and use a for-loop to iterate through the result of the method findObjectsInBackground with Block — [PFObject] —  and at each iteration running another findObjectsInBackground using objectId from each PFObject element and passing it to queryB using whereKey and a</p>
  
  <pre><code> PFObject(withoutDataWithClassName: &lt;&gt;, objectId: &lt;&gt;)
  </code></pre>
  
  <p>which works but leads to asynchronous problems and doesn’t seem quite proper to me.</p>
  
  <p>Any ideas ?</p>
  
  <p>Thanks.</p>