

























1. Delete the repeated records, not include Identity Increment ID (Col0)
DELETE FROM Table
WHERE Col0 NOT IN(
SELECT MIN(Col0)
FROM Table
GROUP BY Col1,Col2,Col3,Col4,Col5
)
2. Get all students' score
SELECT StuID,StuName,
MAX(CASE WHEN ClassName='Math' THEN Score END) AS Math,
MAX(CASE WHEN ClassName='Chinese' THEN Score END) AS Chinese,
MAX(CASE WHEN ClassName='English' THEN Score END) AS English
FROM T
GROUP BY StuID,StuName
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。