Hi,
I am trying to amend a query from Sage as needed to add in the delivery address details but doesn't seem to be working. Below is the original code that I need to amend and have highlighted in yellow in the table below what I am trying to add - any help would be much appreciated?
SELECT SOPInvoiceCredit.DocumentDate, SOPInvoiceCredit.DocumentNo, SOPInvoiceCreditLine.ItemName, SOPInvoiceCreditLine.ItemPrice, SOPInvoiceCreditLine.InvoiceCreditQuantity, SOPInvoiceCreditLine.LineTotalValue, SOPInvoiceCreditLine.OrderReturnNo, SOPOrderReturn.AnalysisCode1, SOPOrderReturn.DocumentCreatedBy, SOPOrderReturn.AnalysisCode2, month(SOPInvoiceCredit.DocumentDate) AS 'Month', SOPOrderReturn.CustomerDocumentNo, SOPOrderReturnLine.ItemCode, SOPInvoiceCredit.SOPInvoiceCreditTypeID, SLCustomerAccount.CustomerAccountNumber AS 'CustomerAccountNumber', SLCustomerAccount.CustomerAccountName, SOPOrderReturn.AnalysisCode5, SOPOrderReturn.AnalysisCode6, SOPOrderReturn.AnalysisCode8, SOPOrderReturnLine.NominalCostCentre AS 'Cost Centre', SOPInvoiceCredit.DocumentStatusID
FROM XXX.dbo.SLCustomerAccount SLCustomerAccount, XXX.dbo.SOPInvoiceCredit SOPInvoiceCredit, XXX.dbo.SOPInvoiceCreditLine SOPInvoiceCreditLine, XXX.dbo.SOPOrderReturn SOPOrderReturn, XXX.dbo.SOPOrderReturnLine SOPOrderReturnLine
WHERE SOPInvoiceCreditLine.SOPInvoiceCreditID = SOPInvoiceCredit.SOPInvoiceCreditID AND SOPOrderReturnLine.SOPOrderReturnLineID = SOPInvoiceCreditLine.SOPOrderReturnLineID AND SOPOrderReturn.SOPOrderReturnID = SOPOrderReturnLine.SOPOrderReturnID AND SLCustomerAccount.SLCustomerAccountID = SOPOrderReturn.CustomerID
Thanks,
Jo