2020-05-19

mysql之上二级

mysql之上二级


#获取会员的上二级drop view if exists vwMemberL2Parent;create view vwMemberL2Parent asselect m.id,    m.parent_id,    m.nickname,    m.realname,    m.avatar,    m.mobile,    m.invite_merch_id,    L2.nickname as L2nickname,    L2.realname as L2realname,    L2.avatar as L2avatar,    L2.mobile as L2mobilefrom `ims_tycb_xyl_member` as m LEFT JOIN `ims_tycb_xyl_member` as L1 on m.parent_id = L1.idLEFT JOIN `ims_tycb_xyl_member` as L2 on L1.parent_id = L2.id

 


No comments:

Post a Comment