How about:
TRANSFORM SUM(q.testval) AS sumoftestval
SELECT q.id,
q.test
FROM (SELECT t2.id,
t2.testdate,
"test1" AS Test,
t2.test1 AS TestVal
FROM t2
UNION ALL
SELECT t2.id,
t2.testdate,
"test2" AS Test,
t2.test2 AS TestVal
FROM t2
UNION ALL
SELECT t2.id,
t2.testdate,
"test3" AS Test,
t2.test3 AS TestVal
FROM t2) AS q
GROUP BY q.id,
q.test
PIVOT q.testdate;
Select an ID
TRANSFORM Sum(q.testval) AS sumoftestval
SELECT q.test
FROM (SELECT t2.id,
t2.testdate,
"test1" AS Test,
t2.test1 AS TestVal
FROM t2
UNION ALL
SELECT t2.id,
t2.testdate,
"test2" AS Test,
t2.test2 AS TestVal
FROM t2
UNION ALL
SELECT t2.id,
t2.testdate,
"test3" AS Test,
t2.test3 AS TestVal
FROM t2) AS q
WHERE q.id=1
GROUP BY q.test
PIVOT q.testdate;
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…