Forum Discussion

A819A1L's avatar
A819A1L
Brass Contributor
Feb 27, 2020

Help with SQL statement to pivot field values into column headers

 

Hello all, I've managed to filter all the data I need but I'm struggling to pivot the [Milestones].[Name] column into headers (there are 25 unique values in this field). 

 

Syntax so far which works:

 

The result I need is something like this:

 

 

I've tried to manually pivot the "Name" field using case statements, but I'm not trying to calculate the values so I'm confused about the need to use aggregate functions.

 

This is the syntax alerting an error:

 

This is the "Milestones" table to use as columns:

 

Could someone please take a look and correct the errors in the code?

 

I would appreciate any assistance offered. Many thanks in advance for your help!

1 Reply

  • A819A1L's avatar
    A819A1L
    Brass Contributor

    I've found a solution for part of the problem which will pivot the Milestones into column headers. But I'm having the same issue with the aggregate function.

     

    How do I display the DateTime instead of counting the entries?

     

Resources