更新时间:2023-02-06 17:52:30
不。
你不能转换使用简单的查询将行转换为列,反之亦然,但是,您可以在代码中轻松执行此操作,遍历行(或列)并在每个步骤中选取另一个的第N个索引每个col(行)。
干杯,
Edo
Nope.
You can''t convert rows into columns and vice versa with a simple query,
however, you can easily do this in your code, iterate through rows (or cols) and on each step pick up the Nth index of the other for each col (row).
Cheers,
Edo
这样......
this way..
SELECT
Date,[1],[3]
FROM
Schedule
PIVOT (MAX([Code]) FOR Session IN ([1],[3])) P
Happy C oding!
:)
Happy Coding!
:)