日期:2014-05-17 浏览次数:20663 次
declare @day date
set @day='2013-12-05'
declare @day_2 date
set @day_2='2013-12-08'
while(@day<@day_2)
begin
SELECT distinct opttype as 消耗项目,sum(ABS(lijinchange))as 消耗量,sum(count(distinct account))as 消费人数,SUM(sum(abs(lijinchange)))as 一天总消耗量,@day as 日期
FROM [mydb_extendsgamelog1].[dbo].[12_TS_PlayerLiJinChange_log]where lijinchange<0 and @day=(convert(date,logtime,105))and opttype not like 'auction buy item comm-%'group by opttype,@day
set @day=dateadd(dd,1,@day)
end
declare @day date
set @day='2013-12-05'
declare @day_2 date
set @day_2='2013-12-08'
while(@day<@day_2)
begin
SELECT distinct opttype as 消耗项目,
sum(ABS(lijinchange))as 消耗量,
sum(count(distinct account))as 消费人数,
SUM(sum(abs(lijinchange)))as 一天总消耗量,
@day as 日期
FROM [mydb_extendsgamelog1].[dbo].[12_TS_PlayerLiJinChange_log]
where lijinchange<0 and @day=(convert(date,logtime,105))and opttype not like 'auction buy item comm-%'
group by opttype,@day -->group by opttype,日期
set @day=dateadd(dd,1,@day)
end