How to convert SQL 2005 Pivot to MS Access SQL

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mnarewec
    New Member
    • Nov 2007
    • 22

    How to convert SQL 2005 Pivot to MS Access SQL

    Team here is my SQL Pivot view. I want to convert to MS Access View. Please assist
    Code:
    USE [cpss]
    GO
    /****** Object:  View [dbo].[qryRptGateOpener2]    Script Date: 10/17/2008 20:41:23 ******/
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    CREATE VIEW [dbo].[qryRptGateOpener2]
    AS
    SELECT     *
    FROM         (SELECT     year(datereceived) AS [Year], alo.branchcode, (((sum(R.qualityscore)) / ((count(alo.matternumber)) * 4)) * 100) AS QualityScorePercentage, 
                                                  CASE datepart(mm, datereceived) 
                                                  WHEN 1 THEN 'January' WHEN 2 THEN 'February' WHEN 3 THEN 'March' WHEN 4 THEN 'April' WHEN 5 THEN 'May' WHEN 6 THEN 'June' WHEN
                                                   7 THEN 'July' WHEN 8 THEN 'August' WHEN 9 THEN 'September' WHEN 10 THEN 'October' WHEN 11 THEN 'November' WHEN 12 THEN 'December'
                                                   ELSE 'unknown month' END AS theMonth
                           FROM          dbo.qryAcceptedLoansOnly ALO LEFT OUTER JOIN
                                                  dbo.tblRegister R ON ALO.Matternumber = R.MatterNumber
                           WHERE      datepart(yyyy, getdate()) = datepart(yyyy, datereceived)
                           GROUP BY CASE datepart(mm, datereceived) 
                                                  WHEN 1 THEN 'January' WHEN 2 THEN 'February' WHEN 3 THEN 'March' WHEN 4 THEN 'April' WHEN 5 THEN 'May' WHEN 6 THEN 'June' WHEN
                                                   7 THEN 'July' WHEN 8 THEN 'August' WHEN 9 THEN 'September' WHEN 10 THEN 'October' WHEN 11 THEN 'November' WHEN 12 THEN 'December'
                                                   ELSE 'unknown month' END, year(datereceived), alo.branchcode) p PIVOT (max(QualityScorePercentage) FOR themonth IN (January, 
                          February, March, April, May, June, July, August, September, October, November, December)) AS pvt
  • NeoPa
    Recognized Expert Moderator MVP
    • Oct 2006
    • 32662

    #2
    Please read the Site Guidelines on posting questions.

    We do not see our role as doing your work for you. We can however, help with specifics.

    Comment

    Working...