on 06-21-2021 2:36 PM
Hi,
We have Inter company Add On, Please help me to build query to get consolidated Sales report across multiple companies in a single query.
Regards
Try this, replace DBNAMEx with real database names
SELECT T0.[DocNum], T0.[DocDate], T0.[CardCode], T0.[CardName], T0.[DocTotal], T1.[ItemCode], T1.[Dscription], T1.[Quantity] FROM DBNAME1.dbo.OINV T0 INNER JOIN DBNAME1.dbo.INV1 T1 ON T0.[DocEntry] = T1.[DocEntry]
UNION ALL
SELECT T0.[DocNum], T0.[DocDate], T0.[CardCode], T0.[CardName], T0.[DocTotal], T1.[ItemCode], T1.[Dscription], T1.[Quantity] FROM DBNAME2.dbo.OINV T0 INNER JOIN DBNAME2.dbo.INV1 T1 ON T0.[DocEntry] = T1.[DocEntry]
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Why not just use UNION ALL?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
98 | |
11 | |
11 | |
6 | |
6 | |
4 | |
4 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.