Formatting and PIVOT

rehaelrehael Posts: 1 New member
edited December 2, 2020 6:45PM in SQL Prompt in ADS
Hi.

It looks like SQL formatting has some trouble when query uses PIVOT.

Original query:

SEleCT 'Shots until passing out' as Shots, Fred, Kate, cOUnT(1) as Foo
fROm (SelECT who, shot FRoM party) up
PIvoT (coUNt(shot) fOR who In (Fred, Kate)) aS p


Formatted (Default style)

SELECT 'Shots until passing out' AS Shots,
       Fred,
       Kate,
       COUNT(1) AS Foo
FROM
(SELECT who, shot FROM party) up
PIVOT
(
    coUNt(shot)
    FOR who IN (Fred, Kate)
) AS p


Formatted (Collapsed style)

SELECT 'Shots until passing out' AS Shots, Fred, Kate, COUNT(1) AS Foo
FROM(SELECT who, shot FROM party) up
PIVOT(coUNt(shot)
FOR who IN(Fred, Kate)) AS p


Questions

1. Why COUNT in PIVOT is not uppercased?
2. Why Collapsed does not indent nor collapse FOR…?

Thanks,
Marcin


Leave a Comment

BoldItalicStrikethroughOrdered listUnordered list
Emoji
Image
Align leftAlign centerAlign rightToggle HTML viewToggle full pageToggle lights
Drop image/file