Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WHERE related field has ALL values in list (AND) #1662

Closed
brockfanning opened this issue Aug 29, 2013 · 4 comments
Closed

WHERE related field has ALL values in list (AND) #1662

brockfanning opened this issue Aug 29, 2013 · 4 comments
Assignees
Labels
Type: Enhancement Enhancements to features that already exist, but are not major additions
Milestone

Comments

@brockfanning
Copy link

Sorry for asking a blatant support question here!

I am trying to get all pods of post_type "news" that are tagged as BOTH "term_1" and "term_2". I'm able to do ORs, but I can't seem to figure out the AND. I had been trying to do this all in the "where" statement, but with no success. Do I actually need to do some manual JOINs?

Any tips to point me in the right direction? Thank you!

@sc0ttkclark
Copy link
Member

@brockfanning Yes, you would need to do manual joins to check on BOTH, as MySQL itself doesn't allow for ALL matches, only IN which is essentially an ANY.

@sc0ttkclark sc0ttkclark changed the title query help needed, multiple terms WHERE related field has ALL values in list (AND) Jun 1, 2015
@sc0ttkclark
Copy link
Member

Great deal of ideas and information here: #1978

@sc0ttkclark sc0ttkclark added the Keyword: Has Bounty Donor has reached out to us and funded this specifically label Jun 1, 2015
pcfreak30 added a commit to pcfreak30/pods that referenced this issue Jun 23, 2015
pcfreak30 added a commit to pcfreak30/pods that referenced this issue Jun 23, 2015
pcfreak30 added a commit to pcfreak30/pods that referenced this issue Jun 23, 2015
pcfreak30 added a commit to pcfreak30/pods that referenced this issue Jun 23, 2015
pcfreak30 added a commit to pcfreak30/pods that referenced this issue Jun 23, 2015
pcfreak30 added a commit to pcfreak30/pods that referenced this issue Jun 23, 2015
pcfreak30 added a commit to pcfreak30/pods that referenced this issue Jun 23, 2015
pcfreak30 added a commit to pcfreak30/pods that referenced this issue Jun 23, 2015
pcfreak30 added a commit to pcfreak30/pods that referenced this issue Jun 23, 2015
pcfreak30 added a commit to pcfreak30/pods that referenced this issue Jun 23, 2015
pcfreak30 added a commit to pcfreak30/pods that referenced this issue Jun 23, 2015
pcfreak30 added a commit to pcfreak30/pods that referenced this issue Jun 23, 2015
@sc0ttkclark sc0ttkclark removed Status: Help Wanted We have not prioritized this yet, but you can help make it happen to speed it up Status: Need Research labels Jul 2, 2015
@sc0ttkclark sc0ttkclark self-assigned this Jul 2, 2015
@sc0ttkclark sc0ttkclark modified the milestones: Pods 2.5.4, Pods Future Release Jul 2, 2015
@sc0ttkclark
Copy link
Member

Fixed by #3033

@sc0ttkclark sc0ttkclark removed the Keyword: Has Bounty Donor has reached out to us and funded this specifically label Dec 29, 2015
@sc0ttkclark
Copy link
Member

sc0ttkclark commented Feb 22, 2020

Following up with the example usage here:

$pod->find(
    [
        'where' => [
            [
                'field' => 'category.name',
                'value' => [
                    'first',
                    'second',
                ],
                'compare' => 'ALL',
            ],
        ]
    ]
);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Enhancement Enhancements to features that already exist, but are not major additions
Projects
None yet
Development

No branches or pull requests

2 participants