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?
- Check if Post Title exists, Insert post if doesn’t, Add Incremental # to Meta if does
- How to use $wpdb to delete in a custom table
- Use wpdb->prepare for `order by` column name
- Export WordPress Posts and Meta Information in CSV format
- Meta compare with date (stored as string) not working
- wpdb->prepare function remove single quote for %s in SQL statment
- How to update/insert custom field(post meta) data with wordpress REST API?
- Front-end update_post_meta snippet displays white screen?
- How to get meta value in wp_attachment_metadata
- Clean up output added via wp_head()
- Is there a (better) way to access $wpdb results?
- get_post_meta returns bool(false)
- get posts and postmetas in assoc array
- How to get custom post type to display post meta on archive pages?
- meta_post_meta return value 1
- Need help writing a $wpdb query
- wpdb_prepare with multiple or condition
- How to use post_id with a Class?
- Set default Custom Post Meta Value
- What’s wrong with my $wpdb prepare?
- INSERT ON DUPLICATE KEY UPDATE failes in postmeta table
- Get stock by custom meta field on all Woocommerce variable products
- Display fields as values in array from external SQL DB
- Set Checkbox as checked by default
- replacing the_autor or make callback
- Some post meta fields stop saving after a few successful saves
- Save an array of values in the post meta box
- get_post_meta() empty in preview WHEN custom post is published [closed]
- Add Embed.ly API objects to post_meta on update
- $wpdb class updating meta_value using Ajax [closed]
- Which is faster wpdb & get_row or wp_query & ge_post_meta?
- How to selected which tags to print, instead of printing the whole tag list?
- query posts and split meta information into separate div’s
- Querying Database with wpdb
- add unique string as custom-field to every post
- “Cannot use import statement outside a module” JS error while adding a custom meta block?
- Use $wpdb or other PHP script method to find/replace in WP database
- Gutenberg featured image checkbox – checkbox not correctly set on editing page reload
- How to properly use oneOf and anyOf in Rest Schema?
- Get the author meta adds now
- wordpress is_front_page() issue
- show ad after # paragraphs
- If ACF meta_key has meta_value
- How we can get “get_post_meta” of specific user who added it
- Repeated nav bar queries failing to be cached
- Randomizing Post Links Outside of Loop – No Author or Date
- Insert Custom Field Value
- I can not display meta value in extras.php and template-tags.php
- How do I list taxonomies that have upcoming events in WP? Is there a way to do this without having to query posts first?
- Strict comparisons problem when using boolean post meta
- Why is the actual number of thumbnail images not matching what is store in an attachments metadata?
- Customising the default wordpress search functionality
- Check if any meta on the post has value then display content
- Combine meta query and give a specific meta query a higher priority
- How can i show post views using specified post ID?
- How to add/update post meta to use in query?
- gettext localization is not working
- Move Entry Meta Above Title in Archives (Genesis + Brunch Pro)
- How to use WHERE NOT EXISTS query to avoid duplicate entry using $wpdb to save in custom table?
- How to get specific table by current user login
- I can’t write in my DB using $wpdb->insert
- How to sort by meta value num, but ignore zero value?
- Update event post meta each day automaticaly
- Advanced Custom Field — grabbing post_meta from previous post
- How to create a link for wordpress meta datas?
- Fetch post meta data on POST request
- Adding an orderby filter, casting postmeta with multiple keys
- get_post_meta() returns nothing in save_post, publish_post, wp_after_insert_post