Try this.
$query = "SELECT * FROM wp_cf7dbplugin_submits a,wp_cf7dbplugin_submits b WHERE a.field_name="Buyer" AND a.field_value = 1 AND a.submit_time = b.submit_time AND b.field_name = carbrand AND b.field_value="Mercedes"";
global $wpdb;
// return the number of rows found
$results = $wpdb->num_rows($query);
var_dump($results);
Related Posts:
- Ignoring initial articles (like ‘a’, ‘an’ or ‘the’) when sorting queries?
- Should I use Transients with W3 Total Cache APC Caching? [closed]
- Add indexing to meta_value in wp_postmeta
- Get posts by menu ID
- Slow SQL_CALC_FOUND_ROWS Query
- What is an efficient way to query based on post_meta?
- WP_Query Performance Issues with meta_query
- Should close $wpdb via $wpdb->close()
- Get the post permalink within the loop but without additional DB query
- Filter WordPress posts by between parameter
- Retrieve featured image (thumbnail) url from multiple posts with one query
- How To Get Some Data From WordPress Database Using WordPress $wpdb Query?
- What’s faster? One big query, or several smaller ones?
- How WordPress attaches its Featured Images with posts?
- Order by custom table and multiplication
- why update and delete query not worked in custom table?
- How to implement a new row_count method in WordPress?
- wp_Qwery works to slow
- Show all data in database table and make it into an interactive table
- No results found from a $wpdb->get_results() query when trying to join more than one meta key query
- database query with more than a couple meta hangs and doesn’t complete
- How to access custom WordPress database tables
- Is it possible to query from external database? [duplicate]
- WP User Query with Custom Fields and Search Results
- List of ways to access WordPress database?
- Specify strict ‘order by’ in WordPress query
- How to set up hierarchical relationships without using plugins / meta query
- how to get Nearby zipcode
- Does WordPress have something like Drupal’s DB API?
- Using Transients
- Slow Query On Search
- how to write wordpress query for multiple metakeys checking?
- Wpdb->query result show 1 but is not an integer
- Why having more than 10 clauses in WP_Query results in some outputs being dropped?
- Storing an array of objects related to each user
- Retrieve data from wordpress db via input and put those result in dropdown
- WP Query – filtering terms with regex
- WP_Query with page_ids in arguments without a result
- Function to retrieve IDs of posts, cache results, and improve wp_query
- Issue with data array format
- Why last row deleted when refresh page
- Query a database based on form input then output to another page [closed]
- wp query search multi terms
- How to get meta key list efficiently?
- How to get user avatar via WPDB
- How to extend WP_query to a specific table?
- Fix wp_term_relationships slow query in get_posts
- Translating WP query into to SQL query
- update_post_meta performance in a loop woocommerce
- update_post_meta performance in a loop woocommerce
- WP_Term_Query->get_terms() very slow query for WordPress filter
- Separate by Category Post Type
- I removed the “wp_rm_logs” table and am constantly getting this error
- Track write actions to the database
- Include post_status check within $wpdb query
- wpdb get_results() returns only 2 rows
- Website goes slow down after importing long database
- WP_Query always returning the last custom post
- option select form always deleting the sql query
- Optimising amount of calls to custom fields
- 294 Queries on Mainpage of WordPress
- how to add limit records in wordpress query
- Custom WP_query in Jnews theme returns thousands of posts
- WP_Query by meta key not returning any posts
- SQL query into to WP query
- how does $wpdb differ to WP_Query?
- WP_Query – filter or directly?
- How can I save an array from a random post sequence for later use?
- Does WordPress generate an automatic page for post formats?
- Why is WP-Query spelled like it is?
- Pagination not working Search posts
- Why I can’t get old posts instead of recent with WP_Query?
- WP_Query arguments to fetch custom post type posts which are in certain category?
- WP_Query loop within WP_Query loop
- How to fetch only media that was already attached to a post/page?
- WP_Query won’t retrieve raw HTML?
- Remove a specific category ID from related post
- Any number in meta key (wp query)
- Understanding the orderby in WP_Query?
- Multisite wp_query & switch_to_blog issue
- complex get_posts() query to select child pages
- Widget only in first post
- How can I change the term “Published” next to # of posts published on WordPress dashboard All Posts page?
- WP_query pagination on frontpage
- WP Query by 4 different taxonomies
- WordPress Query by Category using Post Slug
- WP Query for all events prior to current date
- Displaying posts from sub taxonomies only
- get term objects and post objects in query
- Issue generating custom filter for cpt admin columns
- How to take parameters from a function and make them editable as attributes in a shortcode
- Object of class WP_Query could not be converted to int inside shortcode
- display post multiple times based on array of dates
- Sorting is not working in WordPress WP_Query
- Add custom WP_Query after the first 3 posts
- Weird results using wp-query with ‘date_query’ for last week
- How to count post meta key values for all posts in database
- Why won’t my paged wp_query work? [duplicate]
- 1500+ duplicate queries via get_option function (query monitor)
- after refresh the id that shows correct in first time click, changes to 1