我想了解最近编辑的帖子。我收到了这个问题:
SELECT meta_value, post_title, post_modified
FROM wp_posts
LEFT JOIN wp_postmeta ON wp_posts.ID=wp_postmeta.post_id
WHERE wp_postmeta.meta_key='_edit_last'
在此查询中,meta_value
的结果是用户ID,但我想从user_login
表中获取用户名(wp_users
)。我怎么能这样做?
答案 0 :(得分:2)
我认为你的答案是这样的:
SELECT meta_value, post_title, post_modified, wp_users.user_login
FROM wp_posts
LEFT JOIN wp_postmeta ON wp_posts.ID=wp_postmeta.post_id
LEFT JOIN wp_users ON wp_users.ID=meta_value
WHERE wp_postmeta.meta_key='_edit_last'