How to Retrieve data from unrelated tables?

How to Retrieve data from unrelated tables?
Here is the scenario:

I have 2 tables:

  1. Table ‘User’ - fields: name, objectID
  2. Table ‘UserPets’ - fields: pets, userObjectID
  3. Table ‘pets’ - related to table ‘UserPets’

Given a pet data record, how can retrieve the name field of table ‘Users’, based on the record in ‘UserPets’
Please don’t ask me why the tables are designed such. Assume I can’t change how the database is designed, how do I achieve what I need?

Thanks and bunch!

Hi Peter,

Basically, you will need to make 2 requests:

  1. Retrieve UserPets records referring to the pet data record using the following where clause:
pets.objectID='the_pet_objectId'
  1. Take the userObjectID field values of the returned results and find the appropriate Users with the where clause like the following:
objectId IN ('result_objectId_1', 'result_objectId_2', ...)

Please inform us whether this approach would work for you.