2

我的数据库中有一张表,如下所示。

在此处输入图像描述

所以我想写一个查询,它将返回一个如下表数据。

在此处输入图像描述

4

1 回答 1

0
SELECT EmpId, EmpName, CatalogName, Training1 AS Training
FROM myTable
UNION ALL
SELECT EmpId, EmpName, CatalogName, Training2 AS Training
FROM myTable
UNION ALL
SELECT EmpId, EmpName, CatalogName, Training3 AS Training
FROM myTable
ORDER BY EmpId, Training

SQL 小提琴示例

于 2013-03-11T12:23:19.627 回答