Can't find a way to aggregate and compile data
Asked by Julien Senecal:

Hello all,

I'm trying to get data from multiple tables to expose a summary.

I'm having multiple tables with a status column that can have 5 value (blocker, waiting for, approved, ready for approval, image needed) and I want to see how many of each status I got in overall.

![Screenshot_1.png](https://community.atlassian.com/t5/image/serverpage/image-id/137056i597ED74F7A79C6B4/image-size/large?v=v2&px=999 "Screenshot_1.png")

I can't figure out the proper SQL needed as I have limited knowlegde on that matter.

Here's a sample how one data table

![Screenshot_2.png](https://community.atlassian.com/t5/image/serverpage/image-id/137058iA442DC4F958108FB/image-size/large?v=v2&px=999 "Screenshot_2.png")

Anyone would know how to retrieve this data from multiple table and compile them?

Thanks!


Answers:
author: Katerina Kovriga {Stiltsoft}
body: Hi [@Julien Senecal](/t5/user/viewprofilepage/user-id/4331694) ,

Please follow my example.

**Step 1** will be to wrap every mini table with statuses into the Table Excerpt macro and assign it any name you want (it will be Test for my example):

![Thu 5-1.png](https://community.atlassian.com/t5/image/serverpage/image-id/137086iB2C237D0F8AD2532/image-size/large?v=v2&px=999 "Thu 5-1.png")

![Thu 5-2.png](https://community.atlassian.com/t5/image/serverpage/image-id/137087iF47EEA30D67D4F7E/image-size/large?v=v2&px=999 "Thu 5-2.png")

**Step 2** will be to nest our macros inside each other directly for Server/DC or with the help of the [Table Toolbox](https://docs.stiltsoft.com/display/public/TFAC/How+to+use+Table+Toolbox+macro) for Cloud:

![Thu 5-3.png](https://community.atlassian.com/t5/image/serverpage/image-id/137088i7CD363CC11AD5F85/image-size/large?v=v2&px=999 "Thu 5-3.png")

**Step 3** is to collect all your tables with the help of the [Table Excerpt Include](https://docs.stiltsoft.com/display/public/TFAC/How+to+use+Table+Excerpt+and+Table+Excerpt+Include+macros) macro:

![Thu 5-4.png](https://community.atlassian.com/t5/image/serverpage/image-id/137089i721957D3A0AF2AFB/image-size/large?v=v2&px=999 "Thu 5-4.png")

**Step 4** is to merge your mini tables into the one big result table with the help of the [Table Transformer](https://docs.stiltsoft.com/display/public/TFAC/How+to+use+Table+Transformer+macro) macro (choose the standard Merge preset):

![Thu 5-5.png](https://community.atlassian.com/t5/image/serverpage/image-id/137091iB0C7C1AF905B9FF2/image-size/large?v=v2&px=999 "Thu 5-5.png")

![Thu 5-6.png](https://community.atlassian.com/t5/image/serverpage/image-id/137092iAA553C608D422224/image-size/large?v=v2&px=999 "Thu 5-6.png")

**Step 5** is to count your statuses with the help of the [Pivot Table](https://docs.stiltsoft.com/display/public/TFAC/How+to+use+Pivot+Table+macro) macro:

![Thu 5-7.png](https://community.atlassian.com/t5/image/serverpage/image-id/137093i1E3BB3D575C3172E/image-size/large?v=v2&px=999 "Thu 5-7.png")

And as an optional **step 6** you can visualize your pivot with the help of the [Chart from Table](https://docs.stiltsoft.com/display/public/TFAC/How+to+use+Chart+from+Table+macro) macro:

![Thu 5-8.png](https://community.atlassian.com/t5/image/serverpage/image-id/137094i5376B7E12AF35B6C/image-size/large?v=v2&px=999 "Thu 5-8.png")

Hope this helps your case.