So, I have been working on an SQL query involving the users and usermeta tables in wordpress. I am not getting the correct results. I have the following query written
SELECT * FROM IL9_users LEFT JOIN ( SELECT user_id, MAX(case when meta_key = 'first_name' then meta_value end) first_name, MAX(case when meta_key = 'last_name' then meta_value end) last_name FROM IL9_usermeta ) AS um ON IL9_users.ID = um.user_id
This code returns all of the results except the correct values for first_name and last_name. The first value returned is incorrect, but at least it is being returned. All of the other values are null. Does anyone have any insight on this?