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

  • SEARCH
  • Home
  • 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 8958359
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T15:11:41+00:00 2026-06-15T15:11:41+00:00

Below is my database table structure in MySQL – I want to match specific

  • 0

Below is my database table structure in MySQL – I want to match specific dynamic field values with each other as described below:

meta_id post_id     meta_key            meta_value
616     472         "machine_type"      "Combined pipe cutting"
561     472         _edit_lock          1354882015:1
560     472         _edit_last          1
562     472         _mf_write_panel_id  1
565     472         _wp_page_template   machine_layout.php
617     472         jet_filter          
618     472         "length_x_axis"     "3000mm"
619     472         machine_image       488

Above I have "" quote marked the fields – against which I have to apply the query and fetch result.

Now here, I want to check meta_key field and meta_value field and want to retrieve the matching post_id field’s value.

For ex: my first parameter on meta_key will be length_x_axis and its matching value in meta_value will be 3000mm and AND condition with it will be meta_key for machine_type and its matching value in meta_value will be Combined pipe cutting.

And the result I need is post_id value 472

This is a complete dynamic wordpress wp_postmeta table which will have many records with conditions like this.

Earliest MySQL Query in result will be appreciated.

Please forgive me if any spell mistakes, I have tried my best to explain the community my question.

Please help !

  • 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-06-15T15:11:43+00:00Added an answer on June 15, 2026 at 3:11 pm

    I’m not sure what you really want, but i think that is the query you are looking for:

    SELECT t1.post_id 
    FROM mytable t1 inner join mytable t2 on t1.post_id = t2.post_id 
    WHERE t1.meta_key = "length_x_axis" and t1.meta_value="3000mm" 
    AND t2.meta_key="machine_type" and t2.meta_value="Combined pipe cutting"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

my table(s) structure (MySQL / each one is same as below) +-------+--------------+------+------+-------------------+ | Field
I have a mysql database with a table structure like below : Table Name
I have mysql database structure like below: CREATE TABLE test ( id int(11) NOT
newb question there. Having MySQL database/tables structure below: CREATE DATABASE `dbTest` CREATE TABLE IF
I have created a class which models my existing table in MySql database. Below
I have the following database table below I want to display notification to the
Consider the below situation I have a database table as below user_id user_rank ------------------
I have the following listbox below which binds to a database table of image
need help in error in database pivot. i have table tamed table_score like below:
I have 10 tables in my database(MySQL). two of them is given below tbl_state

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.