Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6475817
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T06:45:01+00:00 2026-05-25T06:45:01+00:00

I have a sql search like below: select distinct user_id from wp_usermeta where (

  • 0

I have a sql search like below:

select distinct user_id from wp_usermeta where ( meta_key='postcode' and meta_value= '3000') or ( meta_key='state' and meta_value= 'vic') or ( meta_key='maternitybg' and meta_value= 'No')

My question is how do I change the query so it searches meta_value 3000, vic and No for user_id? All rows have user_id attached to it so this is why I’m using distinct function as it clears duplicates. The problem at the moment is it gets all users with meta_value of No and this is not what I want as I would like to filter by postcode and state aswell.

Any ideas?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T06:45:02+00:00Added an answer on May 25, 2026 at 6:45 am
    SELECT user_id FROM wp_usermeta
    WHERE ( meta_key='postcode' AND meta_value= '3000') OR
          ( meta_key='state' AND meta_value= 'vic') OR
          ( meta_key='maternitybg' AND meta_value= 'No' )
    GROUP BY user_id
    HAVING COUNT(DISTINCT meta_key) = 3
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have built a T-SQL query like this: DECLARE @search nvarchar(1000) = 'FORMSOF(INFLECTIONAL,hills) AND
I have this sql query: SELECT S.SEARCH, S.STATUS, C.TITLE AS CategoryName, E.SEARCH_ENGINES AS Engine,
I have some problem regarding the search in mysql. Below is my query. SELECT
I have a query similar to this: SELECT itemID FROM itemTable WHERE itemID LIKE
I have set up the full-text search functionality in SQL Server 2008 express. This
Does Microsoft Access have Full Text Search? I know that MySQL and SQL Server
I am trying to query the windows desktop search API using SQL. I have
O, so i have a 'live search' ajax search, which currently runs an sql
I have SQL data that looks like this: events id name capacity 1 Cooking
I have SQL statement: SELECT ASIN, Date, DateSoldActualized, FNSKU, ItemName, MaxShipmentDateAllSkus, MaxShipmentDateThisSKU, MerchantID, MerchantSKU,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.