Pivot Query

From: Subir Kumar (anonymous_at_discussions.microsoft.com)
Date: 06/10/04


Date: Thu, 10 Jun 2004 06:36:53 -0700

Hi,

I am migrating my access database to SQL Server. I have a
crosstab query in Access which is

TRANSFORM Sum(tblCurrentMonth.[Total Price]) AS
[SumOfTotal Price]
SELECT tblCurrentMonth.[Long Code], tblExpenseCodes.
[Report Client], tblCurrentMonth.[Billing Cycle Name], Sum
(tblCurrentMonth.[Total Price]) AS Total
FROM tblExpenseCodes INNER JOIN tblCurrentMonth ON
tblExpenseCodes.[long code] = tblCurrentMonth.[Long Code]
GROUP BY tblCurrentMonth.[Long Code], tblExpenseCodes.
[Report Client], tblCurrentMonth.[Billing Cycle Name]
PIVOT tblCurrentMonth.[Product Name] In ("Data
Center","Desktop","Internet Hosting","Market
Data","Messaging &
Mobile","Network","Other","Projects","Technology Requests
(MAC's)","Voice & Conferencing");

The Pivot and Transform dont seem to work. Can anyone
please suggest me how to write this query in SQL Server.
Thanks in advance for your assistance.

Regards,

Subir



Relevant Pages

  • Pivot Query problem
    ... I am migrating my access database to SQL Server. ... crosstab query in Access which is ... TRANSFORM Sum(tblCurrentMonth.[Total Price]) AS ...
    (microsoft.public.sqlserver.programming)
  • Re: SQL Problem
    ... when_expression is any valid SQL Server expression. ... > price AS Price ... > Modern Cooking Silicon Valley Gastronomi 19.99 ... > Coffee Table Title Cooking with Compute ...
    (microsoft.public.dotnet.general)
  • Re: Selecting Lowest Value from a Table
    ... I also meant to ask you earlier where in this query would I put the INTO ... "Tom Moreau" wrote: ... > Columnist, SQL Server Professional ... > the ManPartNum and Price Fields are repeated in the returned records. ...
    (microsoft.public.sqlserver.server)
  • Re: SQL Problem
    ... when_expression is any valid SQL Server expression. ... > price AS Price ... > Modern Cooking Silicon Valley Gastronomi 19.99 ... > Coffee Table Title Cooking with Compute ...
    (microsoft.public.dotnet.general)
  • Re: Selecting Lowest Value from a Table
    ... ManPartNum, Price and Description, you can use SELECT DISTINCT: ... Columnist, SQL Server Professional ... I also meant to ask you earlier where in this query would I put the INTO clause to allow the joinded records to be inserted into a new table? ... "Tom Moreau" wrote:> You'll have to figure out what other criteria you can use as tiebreakers. ...
    (microsoft.public.sqlserver.server)