I am using the following query to pull out invoices that were ran for payment. How can I attach the vendor address from Business Partners to this query?
SELECT InvKey, DocNum, CardCode, QUOTENAME(CardName,'"'), PostDate, Convert(Decimal(10,2),InvPayAmnt),
CONVERT(VARCHAR(10), T5.PmntDate,101), NumAtCard, PymMeth,
sum(InvPayAmnt) over (partition by CardName) as payment_sum,
'Objtype' = CASE WHEN Objtype = 19 THEN 'CREDIT' ELSE 'INVOICE' END
FROM PWZ3
INNER JOIN OPWZ T5 ON T5.IdNumber = IdEntry
WHERE T5.PmntDate = '5/16/2011'
AND T5.Canceled = 'N'
AND Checked = 'Y'
AND PymMeth = 'PM2'