Created
February 11, 2019 20:27
-
-
Save corysimmons/8960317c61619e40f106ff7a5e6d9815 to your computer and use it in GitHub Desktop.
Combine wp_users and wp_usermeta into a single table with columns (for wp_users) and a big JSON object (for all the wp_usermeta junk).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| SELECT | |
| u.id, | |
| u.user_login, | |
| concat('{ ' , group_concat(concat(m.meta_key, ': ''', m.meta_value, '''')) , ' }' ) AS meta | |
| FROM | |
| wp_users AS u | |
| JOIN | |
| wp_usermeta AS m | |
| WHERE | |
| u.id = m.user_id | |
| GROUP BY | |
| u.id |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment