I always find it way less confusing to get the results from one table and loop them rather than to try to join them like that… eg.
global $wpdb;
$query = "SELECT post_id FROM wp_postmeta WHERE meta_key='fake_author' AND meta_value="11111"";
$results = $wpdb->get_results($query);
foreach ($results as $result) {
$query = "UPDATE wp_posts SET post_author="222222" WHERE ID='".$result->post_id."'";
$wpdb->query($query);
}
Related Posts:
- Get emails from users by custom field SQL
- SQL Query to copy value of a meta_key into another meta_key
- How to correctly call custom field dates into a posts_where filter using SQL statements
- Is it safe to store a user setting you don’t want the user to ever modify as a user option?
- Add custom fields to search
- SELECT max(meta_value) FROM wp_postmeta WHERE meta_key=’price’… stops working when value is over 999
- How to rename a custom field?
- How to get users by a custom field / by user meta data?
- How do you add a custom option to user data?
- Custom user avatar in the WordPress users listing
- User Profile / Add Custom Fields
- importing data from non-wordpress mysql db
- Query meta field using between
- Bulk move (or copy) from a custom field to the post content?
- Show User Their Password
- Up/Down voting system for WordPress
- Custom Fields Bulk Edit
- Adding Properties to User Profile and Displaying in List
- How can I sort get_users() by any value (last_name, user defined fields and more)
- Extra filed under “About the user” user profile
- Move value of one custom field to another
- SQL User Query by Multiple Roles using PHP
- Get multiple custom field values in a $wpdb query [duplicate]
- Difference between ‘LIKE’ and ‘IN’ in meta queries
- get_user_meta Short Profile Section
- little help with a mySQL query to wp database
- Importing users to Buddypress with custom fields
- MySQL query to set wp_postmeta using term_taxonomy_id value
- Redirect users based on custom field
- Custom User Profile Fields
- Add More Fields to Users Pages (Admin Panel)
- Get all posts that do not have a specific custom field without using a subquery
- Register rest field for specific user
- WordPress User Profile Upload – If page is saved file reset
- MySQL Query that looks for post with Custom Field, then changes Category
- Order query by meta_value with multiple custom fields
- How to show a gloabl message on a user profile page (in back end)?
- Custom Field Create Bulk via SQL Query
- Unique Post Meta Values
- WP_User_Query pulling ACF to loop
- Custom Fields – Taller editing area
- Front-end editing with custom fields?
- Passing args to WP_User_Query am I using meta correctly?
- Add custom field to all posts in specific post_type
- Customizing user data
- Linking Custom Fields to Database Records
- Meta Query And/Or
- Show user info in a hovercard [closed]
- WordPress SQL Issue not returning correct reselts
- Customizing WP user profile with custom fields
- Iterate through users and display users meta info at front-page
- Importing WordPress Posts With Custom Meta Data As CSV Files Through PHPMyAdmin
- Inserting data into MagicFields using mysql queries
- Copy price categories to custom field
- ACF: How to get users with a ACF flexible content subfield with a specific value AND layout?
- check for duplicate user meta data before updating
- Custom Field Repeating When Using foreach
- Front end register with custom fields
- Front-End User Profile
- If I update WordPress my custom data will be deleted from the wp_users table?
- Update post meta data (custom field) by post link
- Help setting up a sql query
- SQL: Select wordpress posts with given text string and add a custom field to them?
- Show array of meta_value in Edit Post Coloum
- wpdb function insert doesn’t work
- Save custom field types with this function…?
- How to parse a huge list of users using a CRON function?
- Adding data to User profile
- Delete user meta but only if found in array
- Change word in woocommerce product category custom field
- How to improve my non-unique metadata MySQL entries?
- WP Query – grouping posts by same meta key, adding together values from another key
- Delete a custom field in mysql for all posts with specific category id
- How to save multiple custom user profile fields using repeater JQuery
- SQL query to change the value of a Custom Field
- searching by keywords in post’s metas or pagination links problem
- use mysql to replace one custom field value with another custom field value
- Link fields in User Admin list
- Add commentmeta custom field to every published comment with SQL
- Extend WP_User_Query or WP_User to return all custom fields?
- Convert all dates in field to Unix time, except those already in Unix time
- Copy url from post_content to custom field
- query specific posts according their custom fields, using sql SELECT
- Convert many posts from having a specific meta_key to use a post_format
- Echo text if field under user_meta is empty with get_users()
- Semi-Private Comments + page comments -> is it possible?
- Alter SQL query to return posts with unique custom field value, no duplicate values
- Custom Search, MySql Query Gone Wrong?
- Update field name without losing the value
- file upload user profile
- Can running a WP-Cron to update_post_meta cause performance issues?
- SQL query based on two different custom field values
- Add custom data (field) to sidebar widgets for later display
- put saved metabox values back into fields and then display on the front end
- Custom meta boxes not saving
- How to insert multiple checkbox values into post as custom fields from frontend
- Plugin or shortcode for ISBN number?
- WP Insert post with post_thumbnail
- Insert posting automatically based in acf field
- help for user login