mysql之上二级

database

#获取会员的上二级

dropviewifexists vwMemberL2Parent;

createview vwMemberL2Parent

as

select 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 L2mobile

from `ims_tycb_xyl_member` as m

LEFTJOIN `ims_tycb_xyl_member` as L1 on m.parent_id = L1.id

LEFTJOIN `ims_tycb_xyl_member` as L2 on L1.parent_id = L2.id

 

以上是 mysql之上二级 的全部内容, 来源链接: utcz.com/z/533703.html

回到顶部