cancel
Showing results for 
Search instead for 
Did you mean: 

Consolidated Sales Report SAP B1

afiuddin
Member
0 Kudos

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

Accepted Solutions (1)

Accepted Solutions (1)

hdolenec
Contributor
0 Kudos

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]

Answers (1)

Answers (1)

hdolenec
Contributor
0 Kudos

Hi,

Why not just use UNION ALL?