This will work fine.
global $wpdb;
$querydetails = "
SELECT
wposts.*
FROM
$wpdb->posts AS wposts
INNER JOIN
$wpdb->postmeta AS wpostmeta ON wposts.ID = wpostmeta.post_id
WHERE
wposts.post_status="publish"
AND wposts.post_type="match_report"
AND wpostmeta.meta_key = 'report_home-select'
AND wpostmeta.meta_value="198"
";
$teaminfo = $wpdb->get_results($querydetails, OBJECT);
Try it.
Related Posts:
- Most efficient way to get posts with postmeta
- How to get all term meta for a taxonomy – getting term_meta for taxonomy
- Query between two meta values?
- Short of raw SQL, can I query for multiple attachment metadata that have a given array key?
- Triple meta_key on custom SELECT query
- Get updated post meta on save_post action?
- Get post from meta_key and meta_value
- WP_POSTMETA changes site crash
- Select from wp_post and multiple meta_value from wp_postmeta
- MySQL Query To Select Post By Postmeta
- Set Condition echo function get_post_meta
- Get a row from a separate table by matching a posts meta_key to a tables ID column
- Compare string with post id in wpdb and do stuff when match is found
- cleaning up safely wordpress wp_postmeta table
- Read post meta values, only if posts are public
- How to test the outcome of a wpdb query?
- How do I insert a new meta key / value pair, but only if another meta key is present?
- mass delete posts based on metadata
- Duplicate rows in meta table, any known relations in WC?
- Need a SQL query to update meta_key=’_price’ with value in meta_key=’_regular_price’
- wpdb->get_var – count author posts, meta value
- How to query and update one colum in postmeta table?
- Display current ranking of post as a number in post title
- SQL query – get a featured image’s alt / alternative text
- get specific values from WordPress meta_value
- Get data from custom table and update relative post_meta based on meta_key
- Removing Malware
- Get table parameter and save in meta value
- Exclude category from DB query
- Fetching array of postmeta with $wpdb and in_array conditional
- Cache metadata for set of posts
- How to get all the related ids without array?
- How do I retrieve the slug of the current page?
- How do you properly prepare a %LIKE% SQL statement?
- Get posts by meta value
- Explanation of update_post_(meta/term)_cache
- How to extract data from a post meta serialized array?
- WPDB Insert or if exists Update
- How to save an array with one metakey in postmeta?
- WordPress is stripping escape backslashes from JSON strings in post_meta
- How can I get the post ID from a WP_Query loop?
- Check if Post Title exists, Insert post if doesn’t, Add Incremental # to Meta if does
- Pagination with custom SQL query
- How to use $wpdb to delete in a custom table
- How to update_post_meta value as array
- Adding meta tag without plugin
- What’s the point of get_post_meta’s $single param?
- What is the different between an attachment in wp_posts and an attachment in wp_postmeta?
- How to edit a post meta data in a Gutenberg Block?
- Sanitizing integer input for update_post_meta
- post formats – how to switch meta boxes when changing format?
- $wpdb->get_results(…) returns empty array despite correct query
- Execute action after post is saved with all related post_meta records (data)
- Lack of composite indexes for meta tables
- Use wpdb->prepare for `order by` column name
- get_results on large datasets
- Get a single post by a unique meta value
- SELECT max(meta_value) FROM wp_postmeta WHERE meta_key=’price’… stops working when value is over 999
- if get_post_meta is empty do something
- How to Use Wildcards in $wpdb Queries Using $wpdb->get_results & $wpdb->prepare?
- How we get_post_meta without post id
- How get post id from meta value
- What is the code to get the download link for a product in WooCommerce?
- Safe to delete blank postmeta?
- wpdb get posts by taxonomy SQL
- So much data in postmeta
- advanced custom fields update_field for field type: Taxonomy
- update_post_meta not saving when value is zero
- Export WordPress Posts and Meta Information in CSV format
- Content hooks vs User hooks
- Meta compare with date (stored as string) not working
- Display data from a non wordpress database on a page template
- Trying to get custom post meta through Jetpack JSON API [closed]
- wpdb->prepare function remove single quote for %s in SQL statment
- How to update/insert custom field(post meta) data with wordpress REST API?
- What is the advantage of the wp_options design pattern?
- Restrict post edit/delete based on user ID and custom field
- Multipart/formatted MySQL query problem
- prepare() not working
- get_post_meta returning empty string when data shows in the database
- publish_post action hook doesn’t give post_meta_data
- Remove WordPress.org Meta link
- Remove post meta keys
- How to access the post meta of a post that has just been published?
- Why time functions show invalid time zone when using ‘c’ time format?
- Why is get_post_meta returning an array when I specify it as single?
- How to update/delete array in post meta value?
- Adding an assisting editor box to Post page
- How to display multiple Post meta_key/meta_values by SQL query
- Inserting Post Meta From SQL
- Retrieving custom fields with $wpdb->get_results
- How to make an activities stream mixing posts and comments?
- WPDB Multiple site’s posts and get featured images
- delete unused postmeta
- Should I sanitize custom post meta if it is going to be escaped later?
- Add post meta based on another post meta value before publish post
- What is an efficient way to query based on post_meta?
- How do I retrieve multi-dimensional arrays from the wp_postmeta table, & display on a website?
- Front-end update_post_meta snippet displays white screen?
- Getting users who registered 360 days from current date