Compiling Data from Different Tables

I would like to create a result where I am pulling from different tables that compile orders by month. For instance the Y axis would be the list of clients and the X axis would be the months: Jan 2015, Feb 2015, Mar 2015, etc. and the data produced would be their total number of orders for that month. I also might want to break it down even further into jurisdictions (where they order from - what state, etc.). I've asked our IT team, but they say just to create 12 different reports (for each month) and compile the data manually, but I have a feeling the right SQL query could present this data. Thanks in advance!

If you can show us how the table schema looks like and provide some sample data and expected result, we should be able to work out something for you

Hi, I'm not sure how to copy the information you are asking as we have hundreds of tables, but I thought maybe I could get some general help utilizing broad terminology. The result I'm looking to produce is as follows (X axis is orders by month, Y axis are our clients):

you can achieve that with PIVOTing.

we don't need all those tables. Just those that are required to produce the results that you required

You can use SQL Server Management Studio, right click on the table and "Script Table as Create" and paste it here. This will give the table schema.

1 Like

My admin didn't give me permission to do that, but I can use the PIVOT clue and try Google - thanks!