我有一张表
cID,side,row,column
有一些
的数据24, 1, 10, 5
25, 1, 12, 6
24, 2, 18, 3
等等。现在我希望这些数据以以下形式显示:
cID=24
side 1 2
row 10 18
column 5 3
cID=25
side 2
row 12
column 6
在查询中过滤cID,因此输出将是3行(侧,行,列)以及特定cID的数据。 这可能与MsAccess Query / SQL有关吗?
谢谢!
答案 0 :(得分:2)
这些方面的东西:
TRANSFORM First(q.rvalue) AS firstofrow
SELECT q.rhead
FROM (SELECT cid,
side,
row AS rvalue,
"row" AS rhead
FROM atable
UNION ALL
SELECT cid,
side,
column AS rvalue,
"column" AS rhead
FROM atable) AS q
WHERE q.cid = 24
GROUP BY q.rhead
PIVOT q.side;