Skip to content
Advertisement

Sorting Values into Different Columns

I have a table like this:

There are 8 statuses. I want a query which returns the order id and the dateCreated for each status. If a status has been skipped, I want there to be a null value.

So, for example:

I have tried using multiple joins, but the fact that most of the times statuses have been skipped has proven to be a problem.

Advertisement

Answer

You can use conditional aggregation:

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement