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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T13:59:41+00:00 2026-05-31T13:59:41+00:00

Complex-sounding question but I suspect the answer may be a little easier! My WordPress

  • 0

Complex-sounding question but I suspect the answer may be a little easier!

My WordPress install uses a MySQL database with a table called wp_postmeta.

This table has four columns, meta_id, post_id, meta_key, meta_value.

I have a number of fishkeeping species profiles stored in the wp_posts table which each have an id that links up with the wp_postmeta‘s post_id column.

Each species profile has an entry in the meta table where the meta_key is genus. Similarly they have an entry where the meta_key is species.

wp_posts

    post_id     post_title
    2           Satanoperca daemon (Three spotted daemon)
    4           Betta splendens (Siamese fighting fish)

wp_postmeta

    meta_id     post_id     meta_key    meta_value
    10          2           genus       Satanoperca
    11          2           species     daemon
    12          4           genus       Betta
    13          4           species     splendens

What I need is the genus and species for each species profile I have in the post table, so that I get a list like:

genus       species
Satanoperca daemon
Betta       splendens
Geophagus   steindachneri

Thanks in advance,

  • 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-31T13:59:42+00:00Added an answer on May 31, 2026 at 1:59 pm
    SELECT posts.post_id AS post_id, meta1.meta_value AS genus, meta2.meta_value AS species
      FROM wp_posts posts
        LEFT OUTER JOIN wp_postmeta meta1
          ON posts.post_id = meta1.post_id AND meta1.meta_key = "genus"
        LEFT OUTER JOIN wp_postmeta meta2
          ON posts.post_id = meta2.post_id AND meta2.meta_key = "species"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have quite a complex MySQL query with a problem but I have narrowed
Complex question I assume, but studying OWL opened a new perspective to live, the
I have a complex database model set up in Django, and I have to
I have a complex data model (for EF 4.1 code first) that uses composition
I have an complex algorithm which uses really deep recursion. Because there is stack
I have a somewhat complex SQL query that is pulling from a table of
I have a very complex MySQL query that includes use of the same subquery
I have a fairly complex database that needs to be deployed to a variety
working on a highly complex WordPress theme that features many different custom post types
Have a (rather complex) app that works fine on iOS 4 but fails on

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.