mysql - SQL: joining 3 tables, needing to also join the 3rd to itself -
This works if I remove the last JOIN line, but I'm not sure why it will not work with it . The last two JOIN statements are trying to get data from different rows in the same table ('meta_view'), of which names can be found only by reading another related column ('meta_key') in the same table. While doing all this, everything in all 3 tables on user_id joins in general.
select mod_membership.uid, mod_membership.wp_user_id, mod_membership.status, mod_membership.last_login, mod_membership.membership_type, mod_membership.membership_expiration, wp_users .user_login, wpm_a.meta_value mod_membership as first_name But wp_users.id = mod_membership.wp_user_id wp_usermeta as soon as included wpm_a.user_id = mod_membership.wp_user_id wpm_a Where wpm_a.meta_key = 'first_name' join wp_usermeta wpm_b.user_id = mod_membership wp_users on wpm_b. Wp_user_id Where wpm_b Meta_key = 'last_name'
I use this method to do the third thing, or use another method for such results in a single result set, on user_id How can I get involved?
Try this: your question The reason your syntax was not working, to answer first of all, maybe only on one where the segment per sql The statement can not add any clause to each of the inclusion of you, which is for "on" the clue ... Second, in that situation where the clause is not applied until the end result is produced While the position of the engagement is evaluated as "on the way" because each intermediate result set is composed of each continuous statement.
select m.uid, Join m.wp_user_id, M.status, m.last_login, m.membership_type, m.membership_expiration, u.user_login, f.meta_value first_name, mod_membership meter l.meta_value last_name wp_users u.ID = m.wp_user_id join the left Wp_usermeta f on f.user_id = and f.meta_key = 'first_name' left wp_usermeta add m.wp_user_id at l.user_id = m.wp_user_id and l.meta_key = 'last_name'
Comments
Post a Comment