• Resolved pwsherman

    (@pwsherman)


    Hello,

    Sorry to keep bothering you guys, but I’m still trying to make this a success. I know it should work.

    How can I form a where clause for a related field?

    I have a “countries” pod that references “team_members” (multiple select) in a bi-directional field to a “team_member” pod that references “office_country” (single select). I’m trying to query all the team members of a particular country. Everything I try gives me an “unknown column” error in my PHP.

    $params = array(
        'where' => 'office_country = "Australia"'
    );

    That is my base clause. What can I add to that to get the results I want? Thanks for your help.

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Jory Hogeveen

    (@keraweb)

    Hi @pwsherman

    You are currently comparing the database value to the relationship title. You should change that to the relationship ID as that is what is stored in the database.

    Cheers, Jory

    Plugin Contributor Jim True

    (@jimtrue)

    or use office_country.post_title = "Australia"'

    office_country isn’t a field, it’s the top level of the relationship. You have to traverse into the field on the other side of the relationship.

    Thread Starter pwsherman

    (@pwsherman)

    EUREKA!!!

    Thanks so much! “post_title” did the trick! I get it – traverse into the countries object.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘where clause of related field’ is closed to new replies.