日期:2014-05-17 浏览次数:20456 次
----------------------------
-- Author :DBA_Huangzj(發糞塗牆)
-- Date :2013-10-15 21:53:58
-- Version:
-- Microsoft SQL Server 2012 (SP1) - 11.0.3128.0 (X64)
-- Dec 28 2012 20:23:12
-- Copyright (c) Microsoft Corporation
-- Enterprise Edition (64-bit) on Windows NT 6.2 <X64> (Build 9200: ) (Hypervisor)
--
----------------------------
--> 测试数据:[A]
if object_id('[A]') is not null drop table [A]
go
create table [A]([ID] int,[Class] varchar(4),[UserName] varchar(4),[Name] varchar(4),[Amount] int)
insert [A]
select 1,'一班','张三','数学',90 union all
select 2,'一班','张三','语文',89 union all
select 3,'一班','李四','数学',26 union all
select 4,'一班','李四','语文',31 union all
select 5,'二班','王五','数学',90 union all
select 6,'二