标签:invite level 根据 mysql nbsp order by elf ber self
SELECT
c.id,
c.pid,c.zid,
c.self_invite,m.level_define
from customer_member m,
(
SELECT
id,
pid,zid,
self_invite
FROM
(
SELECT
a1.id,a1.zid,
a1.invite_code pid,
a1.self_invite,
a2.invite_code p2id,
a3.invite_code p3id,
a4.invite_code p4id,
a5.invite_code p5id
FROM
customer a1
LEFT JOIN customer a2 ON (
a1.invite_code = a2.self_invite
)
LEFT JOIN customer a3 ON (
a2.invite_code = a3.self_invite
)
LEFT JOIN customer a4 ON (
a3.invite_code = a4.self_invite
)
LEFT JOIN customer a5 ON (
a4.invite_code = a5.self_invite
)
) al
WHERE
(
pid = ‘AUTYPM‘
OR p2id = ‘AUTYPM‘
OR p3id = ‘AUTYPM‘
OR p4id = ‘AUTYPM‘
OR p5id = ‘AUTYPM‘
) ) c WHERE m.cust_id = c.zid order by id ASC
# ‘AUTYPM‘是该用户自己的邀请码
标签:invite level 根据 mysql nbsp order by elf ber self
原文地址:https://www.cnblogs.com/fanqie15/p/11066064.html