select [Operator],SUM([Data]) as sum from [dbo].[Test_1] GROUP BY [Operator]
select [Operator],SUM([Data]) as sum from [dbo].[Test_1] GROUP BY [Operator] having SUM([Data]) > 400
运行结果:
GROUP BY 对相同的数据进行按组划分,having在这里用作where
select [Operator],SUM([Data]) as sum from [dbo].[Test_1] GROUP BY [Operator]
select [Operator],SUM([Data]) as sum from [dbo].[Test_1] GROUP BY [Operator] having SUM([Data]) > 400
运行结果:
GROUP BY 对相同的数据进行按组划分,having在这里用作where