You can do something like
- Query the wp_posts table
- Left join the source_name from wp_posmeta table
- Left join the coverage_url from wp_posmeta table
Then select the data you want to pull from post, source_name and coverage_url result
Something like this should do
SELECT
post.ID,
post.post_title,
sn.meta_value as source_name,
cu.meta_value as coverage_url
FROM wp_posts as post
LEFT JOIN wp_postmeta as sn
ON post.ID = sn.post_id
AND sn.meta_key = 'source_name'
LEFT JOIN wp_postmeta as cu
ON post.ID = cu.post_id
AND cu.meta_key = 'coverage_url'
WHERE post.post_type="media_coverage"
You Query output should be somethng like
---- ID ----+---- post_title ----+---- source_name ----+---- coverage_url
-------------------------------------------------------------------------
1 | Title Here | Source Name Here | Coverage URL Here
Related Posts:
- Delete duplicate rows from wordpress database where a column is duplicate in phpmyadmin
- Query WordPress database by registered date and role
- SQL query to set posts in bulk based on the post content
- Inserting Post Meta From SQL
- Change SQL get_results to search for posts with custom term in custom taxonomy
- Change all http to https in mysql databse?
- WooCommerce – Query for ordered products
- How to execute mulitple statement SQL queries using $wpdb->query?
- Size article thumbnails and retrieve them directly from database
- How to query the WordPress database to get posts of a certain custom post type, taxonomy and field?
- Select Multiple meta_value from WP DB; Single Query
- wpdb_prepare with multiple or condition
- SQL Error wp_commentmeta – incorrect table definition
- CRUD operations using WordPress database API
- WordPress and MySQL: how to transfer Meta_key and Meta_Value from one post_id to another
- How do I get the posts within a certain year/date(with sql query)?
- Advanced SELECT query with condtional statements
- Slow queries constantly getting stuck on WordPress database of ~100,000 posts
- Create table from array with prepare
- Query multiple tables at once?
- Custom WordPress Table wpdb
- Why this query is not showing any result on wordpresss home page?
- Best practice to limit results in get_row()?
- Why does changing Database Table Prefixes result in loss of content?
- Query Column of Specific ID from Database Table
- $wpdb->get_var – What value is returned when zero records are found?
- How to display data from db in select list [closed]
- DB prefix not updating
- I wanted to Know that how can I give ingore to 0000-00-00 in my config file
- Job and Employee Performance Tracking with Product Safety
- WordPress Database Query works in phpMyAdmin but not in the code
- How to create index (sql) to a meta_key?
- Delete all users meta that named: user_avatar
- The MySQL Connection could not be established., before it was joomla but i have change it into worpress
- Migrated to Namecheap, now Trouble with Database & wp-config [closed]
- export individual posts to text files or a single csv file
- SQL query : Select a thumbnail for a media
- why you don’t Implement PDO for access every thing to database
- SQL query to rewrite all media URLs to end with .webp
- Can’t connect to MySQL server on ‘127.0.0.1’ (10061) (2003)
- MySQL SELECT increment counter
- how to drop partition without dropping data in MySQL?
- MySQL equivalent of DECODE function in Oracle
- WordPress (MyISAM) database is slow, should I switch to InnoDB?
- Restoring WordPress posts from database only
- Getting wrong relationship value in $args in wp_Query?
- Organizing WP Pages based on old website database
- Using Dynamic Data Pulled from a MySQL Table in a WordPress Page
- What are conventions about the schema of the $table_prefix
- Migrating non-WordPress CMS to WordPress, lots of data to move — possible solutions?
- Is deleting orphaned wp_options entries safe?
- How to solve slow WordPress site caused by attachment_metadata
- Would manually deleting the dumping data fix a “#1062 – Duplicate entry ‘1’ for key ‘PRIMARY'” phpMyAdmin error?
- Delete all post meta except featured image
- Large database causes slow load
- WP database error for comments_popup_link()
- Database slowdown after update to 3.4.1
- Tons of Twitter rows in my database
- How to insert data into MySQL database from the form created in WordPress site
- Which is more efficient? Using usermeta, or creating a new MySQL table?
- Hook directly into query execution
- Create WP_Query to search for posts by their categories or their parent/child categories
- Handling large N data in WordPress
- How to Mirror WordPress database from Remote server to Local server
- Is MariaDB’s Aria storage engine suitable for WordPress?
- Difficulty importing my live site to local
- A MySQL DB within a MySQL DB
- Is there a way to recover the table wp_term_relationships?
- Trouble Migrating all data blog from WordPress.com to WordPress.org
- How Can I Put Meta_Compare in the Database-Query?
- WordPress running SQL query to update database from form
- How to fix database error duplicate entry
- Historic WordPress database connection
- Check if an option exists and get its value in one hit
- WPDB SQL query with prepare() returning variable, not db value
- Problems with moving my WordPress site to another domain/server
- How to display content from external db with relevant urls
- Trouble running $wpdb->query() with last_insert_id
- Moving WordPress site to new domain – database import [duplicate]
- Location of WP default mySQL tables creation file?
- How can I query the db to access current post information?
- Insert NULL value using prepare()
- Delete oldest wordpress post (SQL query)
- How can I find user role in Mysql?
- How do I loop/iterate through posts to edit all img tags?
- Featured image from custom to WordPress database
- Correct and secure way to access a custom SQL database in a custom PHP template file
- How to optimise this database query?
- How to retrieve user data based on role using SQL?
- spambot registering without providing email or password, bypassing registration process
- Possible to restore wordpress database from mysql56 and sqlite files?
- Missing latest posts and options after DB migration via phpMyAdmin
- Get multisite count without php?
- Widgets with *internal* links do not display after database migration
- How do i get value from wp_postmeta?
- featured image not showing up with mysql_connect
- Getting deleted users in database
- database search feature
- Importing Concrete5 content to WordPress
- How do I find users by password?