Skip to content
Advertisement

Group query in subquery to get column value as column name

The data i’ve in my database:

I ran a query to group by id and status to get the below result:

I want to use the above query as subquery to get the result below, where the distinct status are column name.

Any other approach to get the final data is also appreciated. Let me know if need more info.

Thanks

Advertisement

Answer

You may use a pivot query here with the help of FILTER:

Demo

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