测试
SELECT
`PromoterId`,
(IFNULL(SUM(`IntervalTotalDeposit`),0) + IFNULL(SUM(`sIntervalTotalDeposit`),0)) HisTotalDeposit,
(IFNULL(SUM(`IntervalTotalWithdrawal`),0) + IFNULL(SUM(`sIntervalTotalWithdrawal`),0)) HisTotalWithdrawal,
(IFNULL(SUM(`IntervalTotalFlow`),0) + IFNULL(SUM(`sIntervalTotalFlow`),0)) HisTotalFlow,
IFNULL(SUM(`IntervalTotalDeposit`),0) HisFirstLevelTotalDeposit,
IFNULL(SUM(`IntervalTotalWithdrawal`),0) HisFirstLevelTotalWithdrawal,
IFNULL(SUM(`IntervalTotalFlow`),0) HisFirstLevelHisTotalFlow
FROM
`NewPlatformData`.`PromoterPerformanceStatisticsPerDay`
WHERE 1=1
AND PromoterId IN
(
1122395
,1122420
,1122421
,1122465
)
GROUP BY RebateType,PromoterId,PromoterName
取款
SELECT 1122395 PromoterId,SUM(Amount) Amount FROM
(
SELECT
IFNULL(SUM(r1.Amount),0)/100 Amount,
r1.UserID,
FROM NewPlatform_Log.RecordUserExchangeOrders20181231235959 r1
WHERE r1.RecordTime>=1539446400 AND r1.RecordTime < 1539792000
AND r1.UserID IN({ item.FirstLevelIds}) AND r1.OrderSattus=1 AND r1.BusinessType=1601001
GROUP BY r1.UserID
) m2
UNION ALL
SELECT 1122420 PromoterId,SUM(Amount) Amount FROM
(
SELECT
IFNULL(SUM(r1.Amount),0)/100 Amount,
r1.UserID,
FROM NewPlatform_Log.RecordUserExchangeOrders20181231235959 r1
WHERE r1.RecordTime>=1539446400 AND r1.RecordTime < 1539792000
AND r1.UserID IN({ item.FirstLevelIds}) AND r1.OrderSattus=1 AND r1.BusinessType=1601001
GROUP BY r1.UserID
) m2
UNION ALL
SELECT 1122421 PromoterId,SUM(Amount) Amount FROM
(
SELECT
IFNULL(SUM(r1.Amount),0)/100 Amount,
r1.UserID,
FROM NewPlatform_Log.RecordUserExchangeOrders20181231235959 r1
WHERE r1.RecordTime>=1539446400 AND r1.RecordTime < 1539792000
AND r1.UserID IN({ item.FirstLevelIds}) AND r1.OrderSattus=1 AND r1.BusinessType=1601001
GROUP BY r1.UserID
) m2
UNION ALL
SELECT 1122465 PromoterId,SUM(Amount) Amount FROM
(
SELECT
IFNULL(SUM(r1.Amount),0)/100 Amount,
r1.UserID,
FROM NewPlatform_Log.RecordUserExchangeOrders20181231235959 r1
WHERE r1.RecordTime>=1539446400 AND r1.RecordTime < 1539792000
AND r1.UserID IN({ item.FirstLevelIds}) AND r1.OrderSattus=1 AND r1.BusinessType=1601001
GROUP BY r1.UserID
) m2
存款
SELECT PromoterId,SUM(Amount) Amount FROM
(
SELECT IFNULL(SUM(r1.PayAmount),0) Amount,r1.UserID,1122420 PromoterId
FROM NewPlatform_Log.RechargePlatformOrder20181231235959 r1
WHERE r1.RecordTime>=1539446400 AND r1.RecordTime < 1539792000
AND r1.UserID IN({ item.FirstLevelIds}) AND r1.PayStatus=1
GROUP BY r1.UserID
) m2
GROUP BY PromoterId
UNION ALL
SELECT PromoterId,SUM(Amount) Amount FROM
(
SELECT IFNULL(SUM(r1.PayAmount),0) Amount,r1.UserID,1122421 PromoterId
FROM NewPlatform_Log.RechargePlatformOrder20181231235959 r1
WHERE r1.RecordTime>=1539446400 AND r1.RecordTime < 1539792000
AND r1.UserID IN({ item.FirstLevelIds}) AND r1.PayStatus=1
GROUP BY r1.UserID
) m2
GROUP BY PromoterId
UNION ALL
SELECT PromoterId,SUM(Amount) Amount FROM
(
SELECT IFNULL(SUM(r1.PayAmount),0) Amount,r1.UserID,1122439 PromoterId
FROM NewPlatform_Log.RechargePlatformOrder20181231235959 r1
WHERE r1.RecordTime>=1539446400 AND r1.RecordTime < 1539792000
AND r1.UserID IN({ item.FirstLevelIds}) AND r1.PayStatus=1
GROUP BY r1.UserID
) m2
GROUP BY PromoterId
UNION ALL
SELECT PromoterId,SUM(Amount) Amount FROM
(
SELECT IFNULL(SUM(r1.PayAmount),0) Amount,r1.UserID,1122457 PromoterId
FROM NewPlatform_Log.RechargePlatformOrder20181231235959 r1
WHERE r1.RecordTime>=1539446400 AND r1.RecordTime < 1539792000
AND r1.UserID IN({ item.FirstLevelIds}) AND r1.PayStatus=1
GROUP BY r1.UserID
) m2
GROUP BY PromoterId
UNION ALL
SELECT PromoterId,SUM(Amount) Amount FROM
(
SELECT IFNULL(SUM(r1.PayAmount),0) Amount,r1.UserID,1122465 PromoterId
FROM NewPlatform_Log.RechargePlatformOrder20181231235959 r1
WHERE r1.RecordTime>=1539446400 AND r1.RecordTime < 1539792000
AND r1.UserID IN({ item.FirstLevelIds}) AND r1.PayStatus=1
GROUP BY r1.UserID
) m2
GROUP BY PromoterId
SELECT FirstLevelIds FROM PromotionSummary WHERE PromoterId=1122420
SELECT FirstLevelIds FROM PromotionSummary WHERE PromoterId=1122421
SELECT FirstLevelIds FROM PromotionSummary WHERE PromoterId=1122439
SELECT FirstLevelIds FROM PromotionSummary WHERE PromoterId=1122457
SELECT FirstLevelIds FROM PromotionSummary WHERE PromoterId=1122465
流水
流水
SELECT IFNULL(SUM(Stake),0)flow,1122420 PromoterId FROM
(
SELECT * FROM NewPlatform_Log.RecordUserScorePerGame20181014235959
UNION ALL
SELECT * FROM NewPlatform_Log.RecordUserScorePerGame20181015235959
UNION ALL
SELECT * FROM NewPlatform_Log.RecordUserScorePerGame20181016235959
UNION ALL
SELECT * FROM NewPlatform_Log.RecordUserScorePerGame20181017235959
) a
WHERE UserID IN({item.FirstLevelIds})
UNION ALL
SELECT IFNULL(SUM(Stake),0)flow,1122421 PromoterId FROM
(
SELECT * FROM NewPlatform_Log.RecordUserScorePerGame20181014235959
UNION ALL
SELECT * FROM NewPlatform_Log.RecordUserScorePerGame20181015235959
UNION ALL
SELECT * FROM NewPlatform_Log.RecordUserScorePerGame20181016235959
UNION ALL
SELECT * FROM NewPlatform_Log.RecordUserScorePerGame20181017235959
) a
WHERE UserID IN({item.FirstLevelIds})
UNION ALL
SELECT IFNULL(SUM(Stake),0)flow,1122439 PromoterId FROM
(
SELECT * FROM NewPlatform_Log.RecordUserScorePerGame20181014235959
UNION ALL
SELECT * FROM NewPlatform_Log.RecordUserScorePerGame20181015235959
UNION ALL
SELECT * FROM NewPlatform_Log.RecordUserScorePerGame20181016235959
UNION ALL
SELECT * FROM NewPlatform_Log.RecordUserScorePerGame20181017235959
) a
WHERE UserID IN({item.FirstLevelIds})
UNION ALL
SELECT IFNULL(SUM(Stake),0)flow,1122457 PromoterId FROM
(
SELECT * FROM NewPlatform_Log.RecordUserScorePerGame20181014235959
UNION ALL
SELECT * FROM NewPlatform_Log.RecordUserScorePerGame20181015235959
UNION ALL
SELECT * FROM NewPlatform_Log.RecordUserScorePerGame20181016235959
UNION ALL
SELECT * FROM NewPlatform_Log.RecordUserScorePerGame20181017235959
) a
WHERE UserID IN({item.FirstLevelIds})
UNION ALL
SELECT IFNULL(SUM(Stake),0)flow,1122465 PromoterId FROM
(
SELECT * FROM NewPlatform_Log.RecordUserScorePerGame20181014235959
UNION ALL
SELECT * FROM NewPlatform_Log.RecordUserScorePerGame20181015235959
UNION ALL
SELECT * FROM NewPlatform_Log.RecordUserScorePerGame20181016235959
UNION ALL
SELECT * FROM NewPlatform_Log.RecordUserScorePerGame20181017235959
) a
WHERE UserID IN({item.FirstLevelIds})