How to Convert Access Transform/Pivot Query for SQL Server

From: Charles Law (blank_at_nowhere.com)
Date: 05/20/04


Date: Thu, 20 May 2021 13:10:45 +0100

I have two queries that I use in Access:

<qrySelect>
SELECT table2.column1, table2.column2, table2.column3, table1.column4 FROM
table1, table2 WHERE table1.column1 = table2.column1
</qrySelect>

<qryResult>
TRANSFORM First(qrySelect.column3) AS FirstOfCode
SELECT qrySelect.column1, qrySelect.column4, First(qrySelect.column3) AS
[Total Of Code] FROM qrySelect GROUP BY qrySelect.column1, qrySelect.column4
PIVOT qrySelect.column2
</qryResult>

I now wish to use them against a SQL Server database but I am unfamiliar
with the equivalent construct of Transform/Pivot in SQL Server. I read in
the MS documentation that I should use ROLLUP on the GROUP BY clause, but
try as I might I cannot make it work.

Can any one suggest how this might be done?

If there is a better newsgroup to post this question in I would be grateful
if someone could point me in the right direction.

TIA

Charles Law



Relevant Pages