hi-server/scripts/check_invites.sql
2026-01-27 03:13:15 -08:00

18 lines
780 B
SQL
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

-- 查看所有已绑定邀请关系的详细信息
-- 包含被邀请人ID、被邀请人账号(Email/Identifier)、推荐人ID、推荐人账号、绑定时间
SELECT
u.id AS '被邀请人ID (Invitee ID)',
(SELECT auth_identifier FROM user_auth_methods WHERE user_id = u.id LIMIT 1) AS '被邀请人账号 (Invitee Account)',
u.referer_id AS '推荐人ID (Referrer ID)',
(SELECT auth_identifier FROM user_auth_methods WHERE user_id = u.referer_id LIMIT 1) AS '推荐人账号 (Referrer Account)',
u.created_at AS '注册时间 (Registered At)'
FROM
user u
WHERE
u.referer_id > 0
ORDER BY
u.id DESC;
-- 如果只想看简单的计数统计
-- SELECT referer_id, count(*) as invite_count FROM user WHERE referer_id > 0 GROUP BY referer_id;