我正在尝试设置wp\\u用户。使用SQL查询为较大的用户数据库显示\\u名称。
到目前为止:
SELECT x.display_name, x.first_name, x.last_name
FROM
(SELECT
u.display_name,
f.meta_value AS \'first_name\',
l.meta_value AS \'last_name\'
FROM
wp_users AS u
INNER JOIN
wp_usermeta f ON f.user_id = u.ID
INNER JOIN
wp_usermeta l ON l.user_id = u.ID
WHERE f.meta_key = \'first_name\'
AND l.meta_key = \'last_name\') AS x;
但尝试将第一个SELECT语句更改为UPDATE不起作用:
UPDATE
wp_users
SET
display_name = CONCAT(x.first_name, \' \', x.last_name)
FROM
(SELECT
u.display_name,
f.meta_value AS \'first_name\',
l.meta_value AS \'last_name\'
FROM
wp_users AS u
INNER JOIN
wp_usermeta f ON f.user_id = u.ID
INNER JOIN
wp_usermeta l ON l.user_id = u.ID
WHERE f.meta_key = \'first_name\'
AND l.meta_key = \'last_name\') AS x;