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 439025
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T20:44:07+00:00 2026-05-12T20:44:07+00:00

Sometimes I think I haven’t got the brain power for programming, I just can’t

  • 0

Sometimes I think I haven’t got the brain power for programming, I just can’t get my head round this.

I’ve got a table called wp_postmeta which looks kind of like this

+-----------+-----------+------------+--------------+
|  meta_id  |  post_id  |  meta_key  |  meta_value  |
+-----------+-----------+------------+--------------+
|    1      |     1     |   type     |   movie      |
+-----------+-----------+------------+--------------+
|    2      |     1     |   name     |  dark knight |
+-----------+-----------+------------+--------------+
|    3      |     2     |    type    |   tv show    |
+-----------+-----------+------------+--------------+
|    4      |     2     |    name    |   lost       |
+-----------+-----------+------------+--------------+
|    5      |     3     |    type    |   tv show    |
+-----------+-----------+------------+--------------+
|    6      |     3     |   name     |  house       |
+-----------+-----------+------------+--------------+
|    7      |     4     |   type     |   movie      |
+-----------+-----------+------------+--------------+
|    8      |     4     |   name     |  godfather   |
+-----------+-----------+------------+--------------+

What I want to do is select the all the movies. I need to find WHERE meta_key = ‘type’ AND meta_value = ‘movie’ then get the meta_key “name” where the post_id’s match and select the meta_value thus giving me “dark knight” and “godfather”.

Sorry for the poor explanation but WordPress doesn’t have a logical structure to this part of the database, making it quite hard to explain.

  • 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-12T20:44:08+00:00Added an answer on May 12, 2026 at 8:44 pm
    select pm2.meta_value as movie_name
      from wp_postmeta as pm1 join wp_postmeta as pm2
        on pm1.post_id = pm2.post_id
      where pm1.meta_key = 'type' and pm1.meta_value = 'movie' and
        pm2.meta_key = 'name'
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is more a kind of logical Question. Sometimes i think my Brain is
I've gone through just about every property I can think of, but haven't found
I think allowing recursion can be very handy sometimes, not because I can code
Yet another one of my idiotic P/Invoke questions... Sometimes I think this stuff is
Sometimes I think that Controller and Command are the same because they both encapsulate
Naming classes is sometimes hard. What do you think name of the class should
I just started with backbone.js, and one thing that I noticed is that sometimes
Sometimes when using Visual Studio it displays a prompt with a filename: This file
Sometimes I heard people discussing about the start-up time for Java. It seems this
Note: I'm using Zend Framework, but I think most of this applies to PHP

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.