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 Answer