Skip to content
Advertisement

How to get overall summary of grouped columns in SQL in a separate column?

I have a grouped query that looks like this that I got from the following query:

The Result is the following:

How I measure performance is the percentage of times there is a late shipment by a warehouse, so I would like to have a column that shows at the company level the average percentage across every warehouse. How can I get the following output in a single query? My only thought on how I would be able to do this would be to make temporary table with the company’s average and join that to the grouped output above.

ideal output:

Advertisement

Answer

If you want the average percentage across all the warehouses, then you can use:

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