You may be able to get the desired results by inserting a DATABASE field into your main table and using that to generate the nested table. For some general guidance, see:
Many to one email merge using tables - Microsoft Community
If you're using a relational database or, Excel workbook with a separate table with just a single instance of each of the grouping criteria, a DATABASE field in a normal ‘letter’ mailmerge main document could be used without the need for a macro. An outline of this approach can be found at:
Mail Merge - To a Word Table on a Single Page - Microsoft Community
For some working examples, see:
Mail Merge: Using One Excel File with Multiple Sheets
Merge excel list into Word Receipt
Although none of these use nested tables, the principles are the same.