Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > microsoft.public.sqlserver.programming > #31357

Re: How do I order the columns on a pivot table?

Newsgroups microsoft.public.sqlserver.programming
Date 2020-04-12 12:43 -0700
References <32b39068-acc8-48ef-ac56-7f80bc2ee65b@googlegroups.com> <XnsAB9D8E503D7CEYazorman@127.0.0.1>
Message-ID <7a25939e-1e2d-4de3-9315-edef91428a1a@googlegroups.com> (permalink)
Subject Re: How do I order the columns on a pivot table?
From John Hall <foundarecord@gmail.com>

Show all headers | View raw


On Sunday, April 12, 2020 at 7:59:26 AM UTC-4, Erland Sommarskog wrote:
> SELECT PE.TestID,
>        MIN(CASE PU.PresentOrder WHEN 1 THEN PE.TextValue END) AS Param1,
>        MIN(CASE PU.PresentOrder WHEN 2 THEN PE.TextValue END) AS Param2,
>        MIN(CASE PU.PresentOrder WHEN 3 THEN PE.TextValue END) AS Param3,
>        MIN(CASE PU.PresentOrder WHEN 4 THEN PE.TextValue END) AS Param4,
>        MIN(CASE PU.PresentOrder WHEN 5 THEN PE.TextValue END) AS Param5
> FROM   ParametersEntries PE
> JOIN   ParametersUser PU ON PE.TestID = PU.TestID
> GROUP  BY PE.TestID

The SQL Management studio is saying this is a view not a pivot table and can't have an ORDER BY.  I simplified this for my question.  I need to order the results and JOIN it on TestID with yet another table.

Back to microsoft.public.sqlserver.programming | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

How do I order the columns on a pivot table? John Hall <foundarecord@gmail.com> - 2020-04-11 09:08 -0700
  Re: How do I order the columns on a pivot table? Erland Sommarskog <esquel@sommarskog.se> - 2020-04-12 13:59 +0200
    Re: How do I order the columns on a pivot table? John Hall <foundarecord@gmail.com> - 2020-04-12 12:02 -0700
      Re: How do I order the columns on a pivot table? Erland Sommarskog <esquel@sommarskog.se> - 2020-04-12 21:32 +0200
      Re: How do I order the columns on a pivot table? John Hall <foundarecord@gmail.com> - 2020-04-15 12:54 -0700
        Re: How do I order the columns on a pivot table? Erland Sommarskog <esquel@sommarskog.se> - 2020-04-16 20:02 +0200
    Re: How do I order the columns on a pivot table? John Hall <foundarecord@gmail.com> - 2020-04-12 12:27 -0700
    Re: How do I order the columns on a pivot table? John Hall <foundarecord@gmail.com> - 2020-04-12 12:43 -0700
      Re: How do I order the columns on a pivot table? Erland Sommarskog <esquel@sommarskog.se> - 2020-04-12 22:31 +0200
        Re: How do I order the columns on a pivot table? John Hall <foundarecord@gmail.com> - 2020-04-12 14:10 -0700
          Re: How do I order the columns on a pivot table? John Hall <foundarecord@gmail.com> - 2020-04-12 14:14 -0700
          Re: How do I order the columns on a pivot table? Erland Sommarskog <esquel@sommarskog.se> - 2020-04-12 23:15 +0200
        Re: How do I order the columns on a pivot table? John Hall <foundarecord@gmail.com> - 2020-04-12 14:18 -0700
          Re: How do I order the columns on a pivot table? Erland Sommarskog <esquel@sommarskog.se> - 2020-04-12 23:41 +0200

csiph-web