CREATE TABLE tbb
( ID INT,
名字 VARCHAR(100),
考核项 VARCHAR(100),
考核成绩 INT
)
GO
INSERT INTO tbb
SELECT 1,'张三',1,80 UNION
SELECT 1,'张三',2,90
SELECT A.ID,A.名字,A.考核项 AS 考核项1,A.考核成绩 AS 成绩,B.考核项 AS 考核项2,B.考核成绩 AS 成绩
FROM tbb AS A,tbb as B
WHERE A.ID = B.ID AND A.名字 = B.名字 AND A.考核项 = 1 AND B.考核项 = 2
ID 名字 考核项1 成绩 考核项2 成绩
1 张三 1 80 2 90
------解决方案--------------------