-- 특정 총판소속 유저에 지급된 내역
SELECT id, nick_name, account_name, t_log_cash.point, t_log_cash.coment, t_log_cash.reg_time,
(SELECT b.id FROM member b WHERE b.idx=member.recommend_member) AS re_id, a_id
FROM mydb.t_log_cash 
join member on t_log_cash.member_idx = member.idx
where t_log_cash.ac_code in (123) and recommend_member in (1838, 1423) and (t_log_cash.reg_time >= '2024-03-01 00:00:00' and t_log_cash.reg_time < '2024-03-16 00:00:00') order by re_id desc, t_log_cash.idx desc ;

-- 특정 어드민 지급
SELECT a_id as adm, id, nick_name, account_name, t_log_cash.point, t_log_cash.coment, t_log_cash.reg_time,
(SELECT b.id FROM member b WHERE b.idx=member.recommend_member) AS '소속총판'
FROM mydb.t_log_cash 
join member on t_log_cash.member_idx = member.idx
where t_log_cash.ac_code in (123, 126) and recommend_member in (1838, 1423) and (t_log_cash.reg_time >= '2024-02-16 00:00:00' and t_log_cash.reg_time < '2024-03-01 00:00:00') order by t_log_cash.idx desc;

-- 총판 쿠폰 지급
SELECT id, nick_name, account_name, t_log_cash.point, t_log_cash.coment, t_log_cash.reg_time,
(SELECT b.id FROM member b WHERE b.idx=member.recommend_member) AS re_id, a_id
FROM mydb.t_log_cash 
join member on t_log_cash.member_idx = member.idx
where t_log_cash.ac_code in (123, 126, 127, 1001, 1002, 1003) and recommend_member in (1423,1838,10268) /*and a_id = 'kkpp1685'*/ and (t_log_cash.reg_time >= '2024-04-16 00:00:00' and t_log_cash.reg_time < '2024-05-01 00:00:00') order by re_id desc, t_log_cash.idx desc ;
