Pivot and Transform in SQL Server

subir.kumar_at_citigroup.com
Date: 05/24/04

  • Next message: John: "Assing rows to a table"
    Date: Mon, 24 May 2004 12:56:42 -0700
    
    

    Hi,

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

    TRANSFORM Sum(qryDatafile2003.[Total Price]) AS
    [SumOfTotal Price]

    SELECT qryDatafile2003.[Product Code], qryDatafile2003.
    [Sub Product Code], tblExpenseCodes.[Report Client], First
    (qryDatafile2003.[Product Name]) AS [FirstOfProduct Name],
    First(qryDatafile2003.[Sub Product Name]) AS [FirstOfSub
    Product Name]

    FROM qryDatafile2003 INNER JOIN tblExpenseCodes ON
    qryDatafile2003.[Long Code] = tblExpenseCodes.[long code]

    GROUP BY qryDatafile2003.[Product Code], qryDatafile2003.
    [Sub Product Code], tblExpenseCodes.[Report Client]

    PIVOT Format([Billing Cycle Name],"mmm") & "-" & Format
    ([Billing Cycle Name],"yy") In ("Apr-03","May-03","Jun-
    03","Jul-03","Aug-03","Sep-03","Oct-03","Nov-03","Dec-
    03","Jan-04","Feb-04","Mar-04");

    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


  • Next message: John: "Assing rows to a table"

    Relevant Pages

    • Pivot and Transform in SQL Server
      ... crosstab query in Access which is ... TRANSFORM SumAS ... [SumOfTotal Price] ... [Sub Product Code], tblExpenseCodes., First ...
      (microsoft.public.sqlserver.programming)
    • Pivot and Transform not working in SQL Server
      ... crosstab query in Access which is ... TRANSFORM SumAS ... [SumOfTotal Price] ... [Sub Product Code], tblExpenseCodes., First ...
      (microsoft.public.access.adp.sqlserver)