开发者

getting status name corresponding to the member_id

开发者 https://www.devze.com 2023-03-15 17:39 出处:网络
This is my datastructure memberstable member_id membertomshiptable member_id membertomshiptable_id memberstatustype_id

This is my datastructure

                 memberstable
                       member_id

                 membertomshiptable 
                          member_id   
                          membertomshiptable_id
                          memberstatustype_id


                membershipstatustable
                      membershipstatustype_id
                      membershipstatus_name

is it possibel to get the membershipstatus name corresponding to member id in members table开发者_开发技巧

would any one pls help me on this...


Mysql JOIN syntax

SELECT st.membershipstatus_name FROM memberstable m
LEFT JOIN membertomshiptable sh ON m.member_id = sh.member_id
LEFT JOIN membershipstatustable st ON sh.memberstatustype_id = st.membershipstatustype_id
WHERE m.member_id = [member_id_here]

But this will return you all the shipping items for all members. You will need to restrict with some WHERE conditions to get info for certain member or certain package(shipping item)

0

精彩评论

暂无评论...
验证码 换一张
取 消