日期:2014-05-18 浏览次数:20469 次
select 推广人姓名,convert(varchar(7),paydate,120) as paydate,sum(充值金额) as 会员充值金额 from( select a.推广人姓名,b.paydate,b.充值金额 from AccountName a left join 充值 b on a.userid=b.userid)t group by 推广人姓名,convert(varchar(7),paydate,120)
------解决方案--------------------
SELECT AccountName,CONVERT(VARCHAR(7),paydate,20) AS 月份,SUM(payamount) AS 会员充值金额 FROM 充值表 AS A ,推广人表 AS B WHERE A.UserId = B.UserId GROUP BY AccountName,CONVERT(VARCHAR(7),paydate,20)
------解决方案--------------------
select b.AccountName, rtrim(year(a.paydate))+'年'+rtrim(month(a.paydate))+'月' '月份', sum(payamount) '会员充值金额' from tab1 a inner join tab2 b on a.UserID=b.UserID group by b.AccountName, rtrim(year(a.paydate))+'年'+rtrim(month(a.paydate))+'月'
------解决方案--------------------
select camp.AcountName,paydate,sum(payamount) from campaign camp inner join pay on camp.userID = pay.userID group by camp.AcountName,paydate