27,579
社区成员
发帖
与我相关
我的任务
分享
declare @bd datetime ='2017-07-06'
select isnull(sum(b.score),0) as SumScore,a.kindid,c.kindName from [thtreasuredb].[dbo].RecordDrawInfo a with(nolock) left join thtreasuredb.dbo.RecordDrawScore b with(nolock) on a.drawid=b.drawid left join [THPlatformDB].[dbo].[GameKindItemWeb] c with(nolock) on a.kindid=c.kindid where userid in(select userid from thaccountsdb.dbo.accountsinfo with(nolock) where isandroid=0 and nullity=0 and userid not in (select account from [THTreasureDB].dbo.web_serialnumlog where type=7)) and b.inserttime>@bd group by a.kindid,c.kindName
select isnull(sum(b.score),0) as SumScore,c.kindid,c.kindName from [thtreasuredb].[dbo].RecordDrawInfo a with(nolock) left join thtreasuredb.dbo.RecordDrawScore b with(nolock) on a.drawid=b.drawid left join [THPlatformDB].[dbo].[GameKindItemWeb] c with(nolock) on a.kindid=c.kindid where userid in(select userid from thaccountsdb.dbo.accountsinfo with(nolock) where isandroid=0 and nullity=0 and userid not in (select account from [THTreasureDB].dbo.web_serialnumlog where type=7)) and b.inserttime>='2017/7/6' group by c.kindid,c.kindName
update STATISTICS [thtreasuredb].[dbo].RecordDrawInfo
update STATISTICS thtreasuredb.dbo.RecordDrawScore
DECLARE @bd DATETIME = '2017-07-06'
SELECT ISNULL(SUM(b.score), 0) AS SumScore,
a.kindid,
c.kindName
FROM [thtreasuredb].[dbo].RecordDrawInfo a WITH (NOLOCK) LEFT
JOIN thtreasuredb.dbo.RecordDrawScore b WITH (NOLOCK)
ON a.drawid = b.drawid
LEFT JOIN [THPlatformDB].[dbo].[GameKindItemWeb] c WITH (NOLOCK)
ON a.kindid = c.kindid
WHERE userid IN (SELECT userid
FROM thaccountsdb.dbo.accountsinfo WITH (NOLOCK)
WHERE isandroid = 0
AND nullity = 0
AND userid NOT IN (SELECT account
FROM [THTreasureDB].dbo.web_serialnumlog
WHERE TYPE = 7))
AND b.inserttime > @bd
GROUP BY
a.kindid,
c.kindName
SELECT ISNULL(SUM(b.score), 0) AS SumScore,
c.kindid,
c.kindName
FROM [thtreasuredb].[dbo].RecordDrawInfo a WITH (NOLOCK) LEFT
JOIN thtreasuredb.dbo.RecordDrawScore b WITH (NOLOCK)
ON a.drawid = b.drawid
LEFT JOIN [THPlatformDB].[dbo].[GameKindItemWeb] c WITH (NOLOCK)
ON a.kindid = c.kindid
WHERE userid IN (SELECT userid
FROM thaccountsdb.dbo.accountsinfo WITH (NOLOCK)
WHERE isandroid = 0
AND nullity = 0
AND userid NOT IN (SELECT account
FROM [THTreasureDB].dbo.web_serialnumlog
WHERE TYPE = 7))
AND b.inserttime >= '2017/7/6'
GROUP BY
c.kindid,
c.kindName
select isnull(sum(b.score),0) as SumScore,a.kindid,c.kindName from [thtreasuredb].[dbo].RecordDrawInfo a with(nolock) left join thtreasuredb.dbo.RecordDrawScore b with(nolock) on a.drawid=b.drawid left join [THPlatformDB].[dbo].[GameKindItemWeb] c with(nolock) on a.kindid=c.kindid where userid in(select userid from thaccountsdb.dbo.accountsinfo with(nolock) where isandroid=0 and nullity=0 and userid not in (select account from [THTreasureDB].dbo.web_serialnumlog where type=7)) and b.inserttime>'2017/7/6' group by a.kindid,c.kindName