日期:2014-05-18 浏览次数:20558 次
CREATE TABLE #temp(
[ID] [bigint] IDENTITY(1,1) NOT NULL,
[Name] [nchar](10) COLLATE Chinese_PRC_CI_AS NULL,
[Class] [nchar](10) COLLATE Chinese_PRC_CI_AS NULL,
[Mark] [numeric](18, 2) NULL,
[Term] [nchar](10) COLLATE Chinese_PRC_CI_AS NULL,
CONSTRAINT [PK_temp] PRIMARY KEY CLUSTERED
(
[ID] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
INSERT INTO #temp([Name],[Class],[Mark],[Term])VALUES('张三','数学','80.5','2001')
INSERT INTO #temp([Name],[Class],[Mark],[Term])VALUES('张三','数学','82.5','2002')
INSERT INTO #temp([Name],[Class],[Mark],[Term])VALUES('张三','数学','83.5','2003')
INSERT INTO #temp([Name],[Class],[Mark],[Term])VALUES('张三','数学','84.5','2004')
INSERT INTO #temp([Name],[Class],[Mark],[Term])VALUES('张三','数学','90','2005')
INSERT INTO #temp([Name],[Class],[Mark],[Term])VALUES('张三','数学','84.5','2006')
INSERT INTO #temp([Name],[Class],[Mark],[Term])VALUES('张三','数学','90','2007')
INSERT INTO #temp([Name],[Class],[Mark],[Term])VALUES('张三','语文','80.5','2001')
INSERT INTO #temp([Name],[Class],[Mark],[Term])VALUES('张三','语文','82.5','2002')
INSERT INTO #temp([Name],[Class],[Mark],[Term])VALUES('张三','语文','70.5','2003')
INSERT INTO #temp([Name],[Class],[Mark],[Term])VALUES('李四','数学','84.5','2000')
INSERT INTO #temp([Name],[Class],[Mark],[Term])VALUES('李四','数学','80.5','2001')
INSERT INTO #temp([Name],[Class],[Mark],[Term])VALUES('李四','数学','60.5','2002')
INSERT INTO #temp([Name],[Class],[Mark],[Term])VALUES('李四','数学','83.5','2003')
INSERT INTO #temp([Name],[Class],[Mark],[Term])VALUES('李四','数学','84.5','2004')
INSERT INTO #temp([Name],[Class],[Mark],[Term])VALUES('李四','数学','90','2005')
INSERT INTO #temp([Name],[Class],[Mark],[Term])VALUES('李四','语文','80.5','2001')
INSERT INTO #temp([Name],[Class],[Mark],[Term])VALUES('李四','语文','82.5','2002')
INSERT INTO #temp([Name],[Class],[Mark],[Term])VALUES('李四','语文','83.5','2003')
INSERT INTO #temp([Name],[Class],[Mark],[Term])VALUES('李四','语文','90','2005')
s