select a.t_accountID from ((SELECT * FROM platform_data1.t_customerRelation where t_promoterID = '20594' union all SELECT * FROM platform_data2.t_customerRelation where t_promoterID = '20594' union all SELECT * FROM platform_data3.t_customerRelation where t_promoterID = '20594' union all SELECT * FROM platform_data4.t_customerRelation where t_promoterID = '20594' union all SELECT * FROM platform_data5.t_customerRelation where t_promoterID = '20594' union all SELECT * FROM platform_data6.t_customerRelation where t_promoterID = '20594' union all SELECT * FROM platform_data7.t_customerRelation where t_promoterID = '20594' union all SELECT * FROM platform_data8.t_customerRelation where t_promoterID = '20594' )) a
select a.t_accountID from ((SELECT * FROM platform_data1.t_relation where t_promoterID <> t_accountID and t_promoterID = '20594' union all SELECT * FROM platform_data2.t_relation where t_promoterID <> t_accountID and t_promoterID = '20594' union all SELECT * FROM platform_data3.t_relation where t_promoterID <> t_accountID and t_promoterID = '20594' union all SELECT * FROM platform_data4.t_relation where t_promoterID <> t_accountID and t_promoterID = '20594' union all SELECT * FROM platform_data5.t_relation where t_promoterID <> t_accountID and t_promoterID = '20594' union all SELECT * FROM platform_data6.t_relation where t_promoterID <> t_accountID and t_promoterID = '20594' union all SELECT * FROM platform_data7.t_relation where t_promoterID <> t_accountID and t_promoterID = '20594' union all SELECT * FROM platform_data8.t_relation where t_promoterID <> t_accountID and t_promoterID = '20594' )) a
select count(*) from ( select * from (SELECT * FROM RecordUserLogoutGame20180925235959 where UserID in ('22099','21388','22047') and GameTimeCount > 0 and RecordTime >= '1543161600' and RecordTime <= '1543334400' union all SELECT * FROM RecordUserLogoutGame20180926235959 where UserID in ('22099','21388','22047') and GameTimeCount > 0 and RecordTime >= '1543161600' and RecordTime <= '1543334400' union all SELECT * FROM RecordUserLogoutGame20180927235959 where UserID in ('22099','21388','22047') and GameTimeCount > 0 and RecordTime >= '1543161600' and RecordTime <= '1543334400' union all SELECT * FROM RecordUserLogoutGame20180928235959 where UserID in ('22099','21388','22047') and GameTimeCount > 0 and RecordTime >= '1543161600' and RecordTime <= '1543334400' union all SELECT * FROM RecordUserLogoutGame20180929235959 where UserID in ('22099','21388','22047') and GameTimeCount > 0 and RecordTime >= '1543161600' and RecordTime <= '1543334400' union all SELECT * FROM RecordUserLogoutGame20180930235959 where UserID in ('22099','21388','22047') and GameTimeCount > 0 and RecordTime >= '1543161600' and RecordTime <= '1543334400' union all SELECT * FROM RecordUserLogoutGame20181008235959 where UserID in ('22099','21388','22047') and GameTimeCount > 0 and RecordTime >= '1543161600' and RecordTime <= '1543334400' union all SELECT * FROM RecordUserLogoutGame20181009235959 where UserID in ('22099','21388','22047') and GameTimeCount > 0 and RecordTime >= '1543161600' and RecordTime <= '1543334400' union all SELECT * FROM RecordUserLogoutGame20181010235959 where UserID in ('22099','21388','22047') and GameTimeCount > 0 and RecordTime >= '1543161600' and RecordTime <= '1543334400' union all SELECT * FROM RecordUserLogoutGame20181011235959 where UserID in ('22099','21388','22047') and GameTimeCount > 0 and RecordTime >= '1543161600' and RecordTime <= '1543334400' union all SELECT * FROM RecordUserLogoutGame20181012235959 where UserID in ('22099','21388','22047') and GameTimeCount > 0 and RecordTime >= '1543161600' and RecordTime <= '1543334400' union all SELECT * FROM RecordUserLogoutGame20181013235959 where UserID in ('22099','21388','22047') and GameTimeCount > 0 and RecordTime >= '1543161600' and RecordTime <= '1543334400' union all SELECT * FROM RecordUserLogoutGame20181015235959 where UserID in ('22099','21388','22047') and GameTimeCount > 0 and RecordTime >= '1543161600' and RecordTime <= '1543334400' union all SELECT * FROM RecordUserLogoutGame20181016235959 where UserID in ('22099','21388','22047') and GameTimeCount > 0 and RecordTime >= '1543161600' and RecordTime <= '1543334400' union all SELECT * FROM RecordUserLogoutGame20181017235959 where UserID in ('22099','21388','22047') and GameTimeCount > 0 and RecordTime >= '1543161600' and RecordTime <= '1543334400' union all SELECT * FROM RecordUserLogoutGame20181018235959 where UserID in ('22099','21388','22047') and GameTimeCount > 0 and RecordTime >= '1543161600' and RecordTime <= '1543334400' union all SELECT * FROM RecordUserLogoutGame20181019235959 where UserID in ('22099','21388','22047') and GameTimeCount > 0 and RecordTime >= '1543161600' and RecordTime <= '1543334400' union all SELECT * FROM RecordUserLogoutGame20181022235959 where UserID in ('22099','21388','22047') and GameTimeCount > 0 and RecordTime >= '1543161600' and RecordTime <= '1543334400' union all SELECT * FROM RecordUserLogoutGame20181023235959 where UserID in ('22099','21388','22047') and GameTimeCount > 0 and RecordTime >= '1543161600' and RecordTime <= '1543334400' union all SELECT * FROM RecordUserLogoutGame20181024235959 where UserID in ('22099','21388','22047') and GameTimeCount > 0 and RecordTime >= '1543161600' and RecordTime <= '1543334400' union all SELECT * FROM RecordUserLogoutGame20181025235959 where UserID in ('22099','21388','22047') and GameTimeCount > 0 and RecordTime >= '1543161600' and RecordTime <= '1543334400' union all SELECT * FROM RecordUserLogoutGame20181026235959 where UserID in ('22099','21388','22047') and GameTimeCount > 0 and RecordTime >= '1543161600' and RecordTime <= '1543334400' union all SELECT * FROM RecordUserLogoutGame20181027235959 where UserID in ('22099','21388','22047') and GameTimeCount > 0 and RecordTime >= '1543161600' and RecordTime <= '1543334400' union all SELECT * FROM RecordUserLogoutGame20181029235959 where UserID in ('22099','21388','22047') and GameTimeCount > 0 and RecordTime >= '1543161600' and RecordTime <= '1543334400' union all SELECT * FROM RecordUserLogoutGame20181030235959 where UserID in ('22099','21388','22047') and GameTimeCount > 0 and RecordTime >= '1543161600' and RecordTime <= '1543334400' union all SELECT * FROM RecordUserLogoutGame20181031235959 where UserID in ('22099','21388','22047') and GameTimeCount > 0 and RecordTime >= '1543161600' and RecordTime <= '1543334400' union all SELECT * FROM RecordUserLogoutGame20181101235959 where UserID in ('22099','21388','22047') and GameTimeCount > 0 and RecordTime >= '1543161600' and RecordTime <= '1543334400' union all SELECT * FROM RecordUserLogoutGame20181102235959 where UserID in ('22099','21388','22047') and GameTimeCount > 0 and RecordTime >= '1543161600' and RecordTime <= '1543334400' union all SELECT * FROM RecordUserLogoutGame20181104235959 where UserID in ('22099','21388','22047') and GameTimeCount > 0 and RecordTime >= '1543161600' and RecordTime <= '1543334400' union all SELECT * FROM RecordUserLogoutGame20181105235959 where UserID in ('22099','21388','22047') and GameTimeCount > 0 and RecordTime >= '1543161600' and RecordTime <= '1543334400' union all SELECT * FROM RecordUserLogoutGame20181106235959 where UserID in ('22099','21388','22047') and GameTimeCount > 0 and RecordTime >= '1543161600' and RecordTime <= '1543334400' union all SELECT * FROM RecordUserLogoutGame20181107235959 where UserID in ('22099','21388','22047') and GameTimeCount > 0 and RecordTime >= '1543161600' and RecordTime <= '1543334400' union all SELECT * FROM RecordUserLogoutGame20181108235959 where UserID in ('22099','21388','22047') and GameTimeCount > 0 and RecordTime >= '1543161600' and RecordTime <= '1543334400' union all SELECT * FROM RecordUserLogoutGame20181109235959 where UserID in ('22099','21388','22047') and GameTimeCount > 0 and RecordTime >= '1543161600' and RecordTime <= '1543334400' union all SELECT * FROM RecordUserLogoutGame20181110235959 where UserID in ('22099','21388','22047') and GameTimeCount > 0 and RecordTime >= '1543161600' and RecordTime <= '1543334400' union all SELECT * FROM RecordUserLogoutGame20181112235959 where UserID in ('22099','21388','22047') and GameTimeCount > 0 and RecordTime >= '1543161600' and RecordTime <= '1543334400' union all SELECT * FROM RecordUserLogoutGame20181113235959 where UserID in ('22099','21388','22047') and GameTimeCount > 0 and RecordTime >= '1543161600' and RecordTime <= '1543334400' union all SELECT * FROM RecordUserLogoutGame20181114235959 where UserID in ('22099','21388','22047') and GameTimeCount > 0 and RecordTime >= '1543161600' and RecordTime <= '1543334400' union all SELECT * FROM RecordUserLogoutGame20181115235959 where UserID in ('22099','21388','22047') and GameTimeCount > 0 and RecordTime >= '1543161600' and RecordTime <= '1543334400' union all SELECT * FROM RecordUserLogoutGame20181116235959 where UserID in ('22099','21388','22047') and GameTimeCount > 0 and RecordTime >= '1543161600' and RecordTime <= '1543334400' union all SELECT * FROM RecordUserLogoutGame20181119235959 where UserID in ('22099','21388','22047') and GameTimeCount > 0 and RecordTime >= '1543161600' and RecordTime <= '1543334400' union all SELECT * FROM RecordUserLogoutGame20181120235959 where UserID in ('22099','21388','22047') and GameTimeCount > 0 and RecordTime >= '1543161600' and RecordTime <= '1543334400' union all SELECT * FROM RecordUserLogoutGame20181121235959 where UserID in ('22099','21388','22047') and GameTimeCount > 0 and RecordTime >= '1543161600' and RecordTime <= '1543334400' union all SELECT * FROM RecordUserLogoutGame20181122235959 where UserID in ('22099','21388','22047') and GameTimeCount > 0 and RecordTime >= '1543161600' and RecordTime <= '1543334400' union all SELECT * FROM RecordUserLogoutGame20181123235959 where UserID in ('22099','21388','22047') and GameTimeCount > 0 and RecordTime >= '1543161600' and RecordTime <= '1543334400' union all SELECT * FROM RecordUserLogoutGame20181124235959 where UserID in ('22099','21388','22047') and GameTimeCount > 0 and RecordTime >= '1543161600' and RecordTime <= '1543334400' union all SELECT * FROM RecordUserLogoutGame20181126235959 where UserID in ('22099','21388','22047') and GameTimeCount > 0 and RecordTime >= '1543161600' and RecordTime <= '1543334400') a GROUP BY a.UserID ) b
select a.t_accountID UserId ,a.MemberRemain from (SELECT t_accountID,ifnull(t_goldCoin,0) + ifnull(t_bankGoldCoin,0) MemberRemain FROM platform_data1.t_userBaseAttrwhere t_accountID in ('22099','21388','22047') group by t_accountID union all SELECT t_accountID,ifnull(t_goldCoin,0) + ifnull(t_bankGoldCoin,0) MemberRemain FROM platform_data2.t_userBaseAttrwhere t_accountID in ('22099','21388','22047') group by t_accountID union all SELECT t_accountID,ifnull(t_goldCoin,0) + ifnull(t_bankGoldCoin,0) MemberRemain FROM platform_data3.t_userBaseAttrwhere t_accountID in ('22099','21388','22047') group by t_accountID union all SELECT t_accountID,ifnull(t_goldCoin,0) + ifnull(t_bankGoldCoin,0) MemberRemain FROM platform_data4.t_userBaseAttrwhere t_accountID in ('22099','21388','22047') group by t_accountID union all SELECT t_accountID,ifnull(t_goldCoin,0) + ifnull(t_bankGoldCoin,0) MemberRemain FROM platform_data5.t_userBaseAttrwhere t_accountID in ('22099','21388','22047') group by t_accountID union all SELECT t_accountID,ifnull(t_goldCoin,0) + ifnull(t_bankGoldCoin,0) MemberRemain FROM platform_data6.t_userBaseAttrwhere t_accountID in ('22099','21388','22047') group by t_accountID union all SELECT t_accountID,ifnull(t_goldCoin,0) + ifnull(t_bankGoldCoin,0) MemberRemain FROM platform_data7.t_userBaseAttrwhere t_accountID in ('22099','21388','22047') group by t_accountID union all SELECT t_accountID,ifnull(t_goldCoin,0) + ifnull(t_bankGoldCoin,0) MemberRemain FROM platform_data8.t_userBaseAttrwhere t_accountID in ('22099','21388','22047') group by t_accountID ) a
select c.t_accountID as UserId , ifnull(c.MemberTotalBase,0) as MemberTotalBase ,ifnull(c.MemberTotalRebate,0) as MemberTotalRebate from(SELECT t_accountID,sum(t_baseValue) MemberTotalBase ,sum(t_rebateValue) MemberTotalRebateFROM(SELECT t_accountID,t_baseValue ,t_rebateValue FROM t_careerRebateDetailLog20181126235959 WHERE 1=1 AND t_rebateTime>=1543161600 AND t_rebateTime<1543334400 AND t_rebateFromAccountID in ('22099','21388','22047') and t_accountID = '20594') AS a1 group by t_accountID) c
SELECT sum(Revenue) as Revenue ,sum(Stake) as Stake from (SELECT ifnull(Revenue,0) as Revenue, ifnull(Stake,0) as Stake ,UserID,EndTime from RecordUserScorePerGame20180925235959 WHERE UserID in ('22099','21388','22047') and EndTime>=1543161600 and EndTime<1543334400 union all SELECT ifnull(Revenue,0) as Revenue, ifnull(Stake,0) as Stake ,UserID,EndTime from RecordUserScorePerGame20180926235959 WHERE UserID in ('22099','21388','22047') and EndTime>=1543161600 and EndTime<1543334400 union all SELECT ifnull(Revenue,0) as Revenue, ifnull(Stake,0) as Stake ,UserID,EndTime from RecordUserScorePerGame20180927235959 WHERE UserID in ('22099','21388','22047') and EndTime>=1543161600 and EndTime<1543334400 union all SELECT ifnull(Revenue,0) as Revenue, ifnull(Stake,0) as Stake ,UserID,EndTime from RecordUserScorePerGame20180928235959 WHERE UserID in ('22099','21388','22047') and EndTime>=1543161600 and EndTime<1543334400 union all SELECT ifnull(Revenue,0) as Revenue, ifnull(Stake,0) as Stake ,UserID,EndTime from RecordUserScorePerGame20180929235959 WHERE UserID in ('22099','21388','22047') and EndTime>=1543161600 and EndTime<1543334400 union all SELECT ifnull(Revenue,0) as Revenue, ifnull(Stake,0) as Stake ,UserID,EndTime from RecordUserScorePerGame20180930235959 WHERE UserID in ('22099','21388','22047') and EndTime>=1543161600 and EndTime<1543334400 union all SELECT ifnull(Revenue,0) as Revenue, ifnull(Stake,0) as Stake ,UserID,EndTime from RecordUserScorePerGame20181001235959 WHERE UserID in ('22099','21388','22047') and EndTime>=1543161600 and EndTime<1543334400 union all SELECT ifnull(Revenue,0) as Revenue, ifnull(Stake,0) as Stake ,UserID,EndTime from RecordUserScorePerGame20181002235959 WHERE UserID in ('22099','21388','22047') and EndTime>=1543161600 and EndTime<1543334400 union all SELECT ifnull(Revenue,0) as Revenue, ifnull(Stake,0) as Stake ,UserID,EndTime from RecordUserScorePerGame20181003235959 WHERE UserID in ('22099','21388','22047') and EndTime>=1543161600 and EndTime<1543334400 union all SELECT ifnull(Revenue,0) as Revenue, ifnull(Stake,0) as Stake ,UserID,EndTime from RecordUserScorePerGame20181004235959 WHERE UserID in ('22099','21388','22047') and EndTime>=1543161600 and EndTime<1543334400 union all SELECT ifnull(Revenue,0) as Revenue, ifnull(Stake,0) as Stake ,UserID,EndTime from RecordUserScorePerGame20181005235959 WHERE UserID in ('22099','21388','22047') and EndTime>=1543161600 and EndTime<1543334400 union all SELECT ifnull(Revenue,0) as Revenue, ifnull(Stake,0) as Stake ,UserID,EndTime from RecordUserScorePerGame20181006235959 WHERE UserID in ('22099','21388','22047') and EndTime>=1543161600 and EndTime<1543334400 union all SELECT ifnull(Revenue,0) as Revenue, ifnull(Stake,0) as Stake ,UserID,EndTime from RecordUserScorePerGame20181007235959 WHERE UserID in ('22099','21388','22047') and EndTime>=1543161600 and EndTime<1543334400 union all SELECT ifnull(Revenue,0) as Revenue, ifnull(Stake,0) as Stake ,UserID,EndTime from RecordUserScorePerGame20181008235959 WHERE UserID in ('22099','21388','22047') and EndTime>=1543161600 and EndTime<1543334400 union all SELECT ifnull(Revenue,0) as Revenue, ifnull(Stake,0) as Stake ,UserID,EndTime from RecordUserScorePerGame20181009235959 WHERE UserID in ('22099','21388','22047') and EndTime>=1543161600 and EndTime<1543334400 union all SELECT ifnull(Revenue,0) as Revenue, ifnull(Stake,0) as Stake ,UserID,EndTime from RecordUserScorePerGame20181010235959 WHERE UserID in ('22099','21388','22047') and EndTime>=1543161600 and EndTime<1543334400 union all SELECT ifnull(Revenue,0) as Revenue, ifnull(Stake,0) as Stake ,UserID,EndTime from RecordUserScorePerGame20181011235959 WHERE UserID in ('22099','21388','22047') and EndTime>=1543161600 and EndTime<1543334400 union all SELECT ifnull(Revenue,0) as Revenue, ifnull(Stake,0) as Stake ,UserID,EndTime from RecordUserScorePerGame20181012235959 WHERE UserID in ('22099','21388','22047') and EndTime>=1543161600 and EndTime<1543334400 union all SELECT ifnull(Revenue,0) as Revenue, ifnull(Stake,0) as Stake ,UserID,EndTime from RecordUserScorePerGame20181013235959 WHERE UserID in ('22099','21388','22047') and EndTime>=1543161600 and EndTime<1543334400 union all SELECT ifnull(Revenue,0) as Revenue, ifnull(Stake,0) as Stake ,UserID,EndTime from RecordUserScorePerGame20181014235959 WHERE UserID in ('22099','21388','22047') and EndTime>=1543161600 and EndTime<1543334400 union all SELECT ifnull(Revenue,0) as Revenue, ifnull(Stake,0) as Stake ,UserID,EndTime from RecordUserScorePerGame20181015235959 WHERE UserID in ('22099','21388','22047') and EndTime>=1543161600 and EndTime<1543334400 union all SELECT ifnull(Revenue,0) as Revenue, ifnull(Stake,0) as Stake ,UserID,EndTime from RecordUserScorePerGame20181016235959 WHERE UserID in ('22099','21388','22047') and EndTime>=1543161600 and EndTime<1543334400 union all SELECT ifnull(Revenue,0) as Revenue, ifnull(Stake,0) as Stake ,UserID,EndTime from RecordUserScorePerGame20181017235959 WHERE UserID in ('22099','21388','22047') and EndTime>=1543161600 and EndTime<1543334400 union all SELECT ifnull(Revenue,0) as Revenue, ifnull(Stake,0) as Stake ,UserID,EndTime from RecordUserScorePerGame20181018235959 WHERE UserID in ('22099','21388','22047') and EndTime>=1543161600 and EndTime<1543334400 union all SELECT ifnull(Revenue,0) as Revenue, ifnull(Stake,0) as Stake ,UserID,EndTime from RecordUserScorePerGame20181019235959 WHERE UserID in ('22099','21388','22047') and EndTime>=1543161600 and EndTime<1543334400 union all SELECT ifnull(Revenue,0) as Revenue, ifnull(Stake,0) as Stake ,UserID,EndTime from RecordUserScorePerGame20181020235959 WHERE UserID in ('22099','21388','22047') and EndTime>=1543161600 and EndTime<1543334400 union all SELECT ifnull(Revenue,0) as Revenue, ifnull(Stake,0) as Stake ,UserID,EndTime from RecordUserScorePerGame20181021235959 WHERE UserID in ('22099','21388','22047') and EndTime>=1543161600 and EndTime<1543334400 union all SELECT ifnull(Revenue,0) as Revenue, ifnull(Stake,0) as Stake ,UserID,EndTime from RecordUserScorePerGame20181022235959 WHERE UserID in ('22099','21388','22047') and EndTime>=1543161600 and EndTime<1543334400 union all SELECT ifnull(Revenue,0) as Revenue, ifnull(Stake,0) as Stake ,UserID,EndTime from RecordUserScorePerGame20181023235959 WHERE UserID in ('22099','21388','22047') and EndTime>=1543161600 and EndTime<1543334400 union all SELECT ifnull(Revenue,0) as Revenue, ifnull(Stake,0) as Stake ,UserID,EndTime from RecordUserScorePerGame20181024235959 WHERE UserID in ('22099','21388','22047') and EndTime>=1543161600 and EndTime<1543334400 union all SELECT ifnull(Revenue,0) as Revenue, ifnull(Stake,0) as Stake ,UserID,EndTime from RecordUserScorePerGame20181025235959 WHERE UserID in ('22099','21388','22047') and EndTime>=1543161600 and EndTime<1543334400 union all SELECT ifnull(Revenue,0) as Revenue, ifnull(Stake,0) as Stake ,UserID,EndTime from RecordUserScorePerGame20181026235959 WHERE UserID in ('22099','21388','22047') and EndTime>=1543161600 and EndTime<1543334400 union all SELECT ifnull(Revenue,0) as Revenue, ifnull(Stake,0) as Stake ,UserID,EndTime from RecordUserScorePerGame20181027235959 WHERE UserID in ('22099','21388','22047') and EndTime>=1543161600 and EndTime<1543334400 union all SELECT ifnull(Revenue,0) as Revenue, ifnull(Stake,0) as Stake ,UserID,EndTime from RecordUserScorePerGame20181028235959 WHERE UserID in ('22099','21388','22047') and EndTime>=1543161600 and EndTime<1543334400 union all SELECT ifnull(Revenue,0) as Revenue, ifnull(Stake,0) as Stake ,UserID,EndTime from RecordUserScorePerGame20181029235959 WHERE UserID in ('22099','21388','22047') and EndTime>=1543161600 and EndTime<1543334400 union all SELECT ifnull(Revenue,0) as Revenue, ifnull(Stake,0) as Stake ,UserID,EndTime from RecordUserScorePerGame20181030235959 WHERE UserID in ('22099','21388','22047') and EndTime>=1543161600 and EndTime<1543334400 union all SELECT ifnull(Revenue,0) as Revenue, ifnull(Stake,0) as Stake ,UserID,EndTime from RecordUserScorePerGame20181031235959 WHERE UserID in ('22099','21388','22047') and EndTime>=1543161600 and EndTime<1543334400 union all SELECT ifnull(Revenue,0) as Revenue, ifnull(Stake,0) as Stake ,UserID,EndTime from RecordUserScorePerGame20181101235959 WHERE UserID in ('22099','21388','22047') and EndTime>=1543161600 and EndTime<1543334400 union all SELECT ifnull(Revenue,0) as Revenue, ifnull(Stake,0) as Stake ,UserID,EndTime from RecordUserScorePerGame20181102235959 WHERE UserID in ('22099','21388','22047') and EndTime>=1543161600 and EndTime<1543334400 union all SELECT ifnull(Revenue,0) as Revenue, ifnull(Stake,0) as Stake ,UserID,EndTime from RecordUserScorePerGame20181103235959 WHERE UserID in ('22099','21388','22047') and EndTime>=1543161600 and EndTime<1543334400 union all SELECT ifnull(Revenue,0) as Revenue, ifnull(Stake,0) as Stake ,UserID,EndTime from RecordUserScorePerGame20181104235959 WHERE UserID in ('22099','21388','22047') and EndTime>=1543161600 and EndTime<1543334400 union all SELECT ifnull(Revenue,0) as Revenue, ifnull(Stake,0) as Stake ,UserID,EndTime from RecordUserScorePerGame20181105235959 WHERE UserID in ('22099','21388','22047') and EndTime>=1543161600 and EndTime<1543334400 union all SELECT ifnull(Revenue,0) as Revenue, ifnull(Stake,0) as Stake ,UserID,EndTime from RecordUserScorePerGame20181106235959 WHERE UserID in ('22099','21388','22047') and EndTime>=1543161600 and EndTime<1543334400 union all SELECT ifnull(Revenue,0) as Revenue, ifnull(Stake,0) as Stake ,UserID,EndTime from RecordUserScorePerGame20181107235959 WHERE UserID in ('22099','21388','22047') and EndTime>=1543161600 and EndTime<1543334400 union all SELECT ifnull(Revenue,0) as Revenue, ifnull(Stake,0) as Stake ,UserID,EndTime from RecordUserScorePerGame20181108235959 WHERE UserID in ('22099','21388','22047') and EndTime>=1543161600 and EndTime<1543334400 union all SELECT ifnull(Revenue,0) as Revenue, ifnull(Stake,0) as Stake ,UserID,EndTime from RecordUserScorePerGame20181109235959 WHERE UserID in ('22099','21388','22047') and EndTime>=1543161600 and EndTime<1543334400 union all SELECT ifnull(Revenue,0) as Revenue, ifnull(Stake,0) as Stake ,UserID,EndTime from RecordUserScorePerGame20181110235959 WHERE UserID in ('22099','21388','22047') and EndTime>=1543161600 and EndTime<1543334400 union all SELECT ifnull(Revenue,0) as Revenue, ifnull(Stake,0) as Stake ,UserID,EndTime from RecordUserScorePerGame20181111235959 WHERE UserID in ('22099','21388','22047') and EndTime>=1543161600 and EndTime<1543334400 union all SELECT ifnull(Revenue,0) as Revenue, ifnull(Stake,0) as Stake ,UserID,EndTime from RecordUserScorePerGame20181112235959 WHERE UserID in ('22099','21388','22047') and EndTime>=1543161600 and EndTime<1543334400 union all SELECT ifnull(Revenue,0) as Revenue, ifnull(Stake,0) as Stake ,UserID,EndTime from RecordUserScorePerGame20181113235959 WHERE UserID in ('22099','21388','22047') and EndTime>=1543161600 and EndTime<1543334400 union all SELECT ifnull(Revenue,0) as Revenue, ifnull(Stake,0) as Stake ,UserID,EndTime from RecordUserScorePerGame20181114235959 WHERE UserID in ('22099','21388','22047') and EndTime>=1543161600 and EndTime<1543334400 union all SELECT ifnull(Revenue,0) as Revenue, ifnull(Stake,0) as Stake ,UserID,EndTime from RecordUserScorePerGame20181115235959 WHERE UserID in ('22099','21388','22047') and EndTime>=1543161600 and EndTime<1543334400 union all SELECT ifnull(Revenue,0) as Revenue, ifnull(Stake,0) as Stake ,UserID,EndTime from RecordUserScorePerGame20181116235959 WHERE UserID in ('22099','21388','22047') and EndTime>=1543161600 and EndTime<1543334400 union all SELECT ifnull(Revenue,0) as Revenue, ifnull(Stake,0) as Stake ,UserID,EndTime from RecordUserScorePerGame20181117235959 WHERE UserID in ('22099','21388','22047') and EndTime>=1543161600 and EndTime<1543334400 union all SELECT ifnull(Revenue,0) as Revenue, ifnull(Stake,0) as Stake ,UserID,EndTime from RecordUserScorePerGame20181118235959 WHERE UserID in ('22099','21388','22047') and EndTime>=1543161600 and EndTime<1543334400 union all SELECT ifnull(Revenue,0) as Revenue, ifnull(Stake,0) as Stake ,UserID,EndTime from RecordUserScorePerGame20181119235959 WHERE UserID in ('22099','21388','22047') and EndTime>=1543161600 and EndTime<1543334400 union all SELECT ifnull(Revenue,0) as Revenue, ifnull(Stake,0) as Stake ,UserID,EndTime from RecordUserScorePerGame20181120235959 WHERE UserID in ('22099','21388','22047') and EndTime>=1543161600 and EndTime<1543334400 union all SELECT ifnull(Revenue,0) as Revenue, ifnull(Stake,0) as Stake ,UserID,EndTime from RecordUserScorePerGame20181121235959 WHERE UserID in ('22099','21388','22047') and EndTime>=1543161600 and EndTime<1543334400 union all SELECT ifnull(Revenue,0) as Revenue, ifnull(Stake,0) as Stake ,UserID,EndTime from RecordUserScorePerGame20181122235959 WHERE UserID in ('22099','21388','22047') and EndTime>=1543161600 and EndTime<1543334400 union all SELECT ifnull(Revenue,0) as Revenue, ifnull(Stake,0) as Stake ,UserID,EndTime from RecordUserScorePerGame20181123235959 WHERE UserID in ('22099','21388','22047') and EndTime>=1543161600 and EndTime<1543334400 union all SELECT ifnull(Revenue,0) as Revenue, ifnull(Stake,0) as Stake ,UserID,EndTime from RecordUserScorePerGame20181124235959 WHERE UserID in ('22099','21388','22047') and EndTime>=1543161600 and EndTime<1543334400 union all SELECT ifnull(Revenue,0) as Revenue, ifnull(Stake,0) as Stake ,UserID,EndTime from RecordUserScorePerGame20181125235959 WHERE UserID in ('22099','21388','22047') and EndTime>=1543161600 and EndTime<1543334400 union all SELECT ifnull(Revenue,0) as Revenue, ifnull(Stake,0) as Stake ,UserID,EndTime from RecordUserScorePerGame20181126235959 WHERE UserID in ('22099','21388','22047') and EndTime>=1543161600 and EndTime<1543334400 ) as a