How to Convert Access Transform/Pivot Query for SQL Server

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Charles Law

    How to Convert Access Transform/Pivot Query for SQL Server

    I have posted this on a couple of Access and SQL Server newsgroups, but with
    no answer yet. There seems to be very little activity on the ones I have
    looked at, so I thought I would post here as well, since I have no doubt
    that many people here also use Access/SQL Server. Anyway, enough of my
    rambling and on with the problem/question.

    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.colum n1, qrySelect.colum n4, First(qrySelect .column3) AS
    [Total Of Code] FROM qrySelect GROUP BY qrySelect.colum n1, qrySelect.colum n4
    PIVOT qrySelect.colum n2
    </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



  • Cor Ligthert

    #2
    Marina, I promished Charles to try to put your attention on this.



    Comment

    • Cor Ligthert

      #3
      Re: How to Convert Access Transform/Pivot Query for SQL Server

      Hi Charles,

      I have checked which is the major SQL newsgroup and saw you had not placed
      this message there.

      It is not less smaller than the framework.aspne t newsgroup

      Maybe you have a change there,

      microsoft.publi c.sqlserver.pro gramming

      Cor


      Comment

      • Charles Law

        #4
        Re: How to Convert Access Transform/Pivot Query for SQL Server

        Thanks Cor. I will try my luck there as well.

        Charles


        "Cor Ligthert" <notfirstname@p lanet.nl> wrote in message
        news:%236C3LYAQ EHA.640@TK2MSFT NGP12.phx.gbl.. .[color=blue]
        > Hi Charles,
        >
        > I have checked which is the major SQL newsgroup and saw you had not placed
        > this message there.
        >
        > It is not less smaller than the framework.aspne t newsgroup
        >
        > Maybe you have a change there,
        >
        > microsoft.publi c.sqlserver.pro gramming
        >
        > Cor
        >
        >[/color]


        Comment

        • Cor Ligthert

          #5
          Re: How to Convert Access Transform/Pivot Query for SQL Server



          Do you know this link, is from Google.

          Cor


          Comment

          • Charles Law

            #6
            Re: How to Convert Access Transform/Pivot Query for SQL Server

            Thanks Cor. That looks like a good solution. I will try it. I had searched
            Google but didn't turn this one up. I can't have been looking for the right
            thing :-)

            Cheers.

            Charles


            "Cor Ligthert" <notfirstname@p lanet.nl> wrote in message
            news:OggIofNQEH A.3748@TK2MSFTN GP09.phx.gbl...[color=blue]
            > http://www.sqlteam.com/item.asp?ItemID=2955
            >
            > Do you know this link, is from Google.
            >
            > Cor
            >
            >[/color]


            Comment

            Working...