Skip to content
Advertisement

How to combine monthly results into a single row?

If have a sales table with data like:

I would like to retrieve all seller’s sales in a single row. How can I combine the results from the table into a result like this?

EDIT:

I can retrieve the monthly sales with this query:

But it gives me results like:

I’m hoping to transform this into:

Advertisement

Answer

You may use conditional aggregation to pivot your data with the following SQL statement as :

As an Oracle user, you may use the following SQL statement with pivot keyword as :

Rextester Demo

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