You need 2 table joins since there are effectively 2 meta keys in your WHERE clause:
SELECT DISTINCT
SQL_CALC_FOUND_ROWS wp_users.*
FROM
wp_users
INNER JOIN wp_usermeta AS um1 ON (wp_users.ID = um1.user_id)
INNER JOIN wp_usermeta AS um2 ON (wp_users.ID = um2.user_id)
WHERE
(wp_users.user_login LIKE '%little%'
OR wp_users.user_email LIKE '%little%'
OR wp_users.user_url LIKE '%little%'
OR wp_users.display_name LIKE '%little%'
OR (um1.meta_key = 'first_name'
AND um1.meta_value LIKE '%little%')
OR (um1.meta_key = 'last_name'
AND um1.meta_value LIKE '%little%'))
AND((um2.meta_key = 'car_type'
AND um2.meta_value LIKE '%Camry%')
OR(um2.meta_key = 'car_type'
AND um2.meta_value LIKE '%Toyota%'))
ORDER BY
user_registered DESC
Related Posts:
- Getting wrong relationship value in $args in wp_Query?
- How is the data stored in the database?
- Activation hook not creating table
- Is the usage of ON DELETE CASCADE wrong or not allowed on wordpress?
- Version upgrade: can my plugin filter the SQL statements issued during a database upgrade?
- WordPress database error for query INSERT INTO
- How to connect to AWS RDS external database (not for the core WordPress db)
- Alternative functions for mysql_free_result and mysql_ping in wordpress functions
- Two different wordpress sites – same server and IP address. Gaining Access to database 1 of 2
- What might be the reason of Couldn’t fetch mysqli_result on another domain?
- WordPress database error: [Query was empty] – using $wpdb->prepare()
- WordPress how do I echo SUM from a column of a MySQL table by user id AND type_operation
- WordPress doesn’t create table on plugin activation
- Organising and completing posts (mark as read and hide)
- pull data from wordpress database
- How to filter get_adjacent_post()?
- MySQL Error: : ‘Access denied for user ‘root’@’localhost’
- Case statement in MySQL
- how to drop partition without dropping data in MySQL?
- Creating a search form in PHP to search a database?
- MySQL equivalent of DECODE function in Oracle
- Error: Duplicate entry ‘0’ for key ‘PRIMARY’
- Is it mandatory to use $wpdb->prefix in custom tables
- Default table collation on plugin activation?
- How to get data from WordPress $wpdb into React Gutenberg Blocks Frontend?
- What is the added “complexity” of custom tables?
- How to modify post content before writing to database?
- Actions or filters fired when data is saved in a custom table
- Retrieving custom fields with $wpdb->get_results
- How to Join two tables from separate databases within WordPress
- Display only certain posts based on visitor’s country?
- Would manually deleting the dumping data fix a “#1062 – Duplicate entry ‘1’ for key ‘PRIMARY'” phpMyAdmin error?
- How to add SQL file with PHP to WordPress database [closed]
- Delete duplicate rows from wordpress database where a column is duplicate in phpmyadmin
- Passing array of strings to a SQL statement in a WordPress plugin
- Query WordPress database by registered date and role
- What for the tables ending with the meta used in database of wordpress?
- Creating table with plugin is not working
- query users by role
- How to Create database table when Plugin installed/activated, and delete database when Plugin deleted
- SQL Error wp_commentmeta – incorrect table definition
- I’m designing a plugin to create database indexes. Suggestions?
- SQL query for custom taxonomy slugs
- Database Tables Lost Indexes? How to Recover?
- Are there any scripts, classes, and/or functions built-in to WP for a plugin to export/import its saved data from wp_options?
- Strange issue saving custom field data for a WooCommerce order
- Prevent duplicate records in plugin table
- Form doesnt save to database
- Updating Woocommerce Settings API when WordPress Settings API saved and vise versa
- Update results, Before deleting the related category [closed]
- Is using custom table to suit business needs instead of transients a big hit to page load speed?
- How to add user details to different tables immediately after user registration
- mysql_real_escape_string() vs. esc_sql() in WordPress
- Optimising a big WordPress site
- What is the best way to store a few fields?
- Delete data from database using row action
- How do I have now a duplicated user entry if this is not allowed (and I cannot replicate it)?
- Why this query is not showing any result on wordpresss home page?
- wpdb prepare insert table doesn’t work
- Make Database query only when option is updated
- SQL query to set posts in bulk based on the post content
- How can I programmatically change a MySql variable (foreign_keys_check)?
- Plugin Development: Storing and Manipulating Data That Fits JSON in Database
- WordPress plugin: efficient way to store large data
- How do I debug an error that a plugin is causing?
- Create an user on external database
- Update plugin settings option_name for big plugin update
- What could cause a WP Option to get truncated?
- select a single val though a table in wordpress
- Integrating Custom Database with WordPress
- How to Get Last ID?
- Performing CRUD operations on front end in wordpress
- I wanted to Know that how can I give ingore to 0000-00-00 in my config file
- How to get inserted row IDs for bulk/batch insert with wpdb query?
- Bulk find & replace on WordPress posts/pages (minus image paths)
- Save in my custom admin page and redirect to the saved object
- Relational / Associate tables using native WordPress functionality
- WordPress delete mysql rows with string
- How to store in the database directly the translation?
- The MySQL Connection could not be established., before it was joomla but i have change it into worpress
- How and when would I implement some code which would take data from one part of the Db and put it in another?
- Plugin MySQL SELECT custom data and filter on user meta
- sql query not working in wp plugin
- $wpdb Mysql trigger problem
- Why Worpdress doesn’t create table in database?
- Associating special meaning with user id 0
- How to add chunk of php, html, and sql code to variable an append to $content
- What method should I use to store my plugin data (multi level menus with options on each item)
- How to add additional field in a table row after creating a table?
- WordPress plugin tables become corrupt
- Nothing happens on WordPress Update command
- Migrated to Namecheap, now Trouble with Database & wp-config [closed]
- SQL query : Select a thumbnail for a media
- SQL Query to get post_id from wp_posts and and meta_key(s) from wp_postmeta
- How can I delete the options from DB when the plugin is deleted?
- Leveraging Core Functionality in Icon Upload Plugin [closed]
- WordPress database error: [Table ‘bitnami_wordpress.questions’ doesn’t exist]
- Making a user platform reachable by a qr code on a pin-back-button [closed]
- select rows based on exact time (hours, minutes and seconds)
- multiple record insert creating many duplicate records