Instead of making 'UNION' query for companies that are under the same holding company and the database are built up the same way for name etc. Creating Data Providers for each company could make the query easier in the long run. For example it will make the query shorter and decrease duplicates.

  1. Start by duplicate Data Provider Nav for each company. 
  2. In each Data Providers put under 'Parameters' 'Name' {#NavPrefix} and then the name of the company. 
  3. Then create Nav for all companies and then select Data Providers that should be included. 

Then you can delete the Union duplicates for each company and only write the query once and use the following instead (for unlisted sales transactions e.g.): 


select '{#NavPrefix}' as Name,a.[Store No_], a.Date, count(*) As 'Unbooked transactions', SUM(b.[Net Amount]) as 'Amount missing'

from [{#NavPrefix}$Trans_ Sales Entry Status] a

join [{#NavPrefix}$Trans_ Sales Entry] b

on a.[POS Terminal No_] = b.[POS Terminal No_] and a.[Transaction No_] = b.[Transaction No_] and a.Date = b.Date and a.[Line No_] = b.[Line No_]

where a.[Status] = 0 

group by a.[Store No_], a.Date