I am trying to write a query that will display fields from the ORDR, RDR1, OCRD, and OSLP tables. I cannot get this query to run though. I think there is an issue with the way the joins are setup.
SELECT T1.[DocDate] AS 'Posting Date', T1.[DocNum] AS 'Document Number', T2.[CardFName] AS 'Foreign Name', T1.[CardName] AS 'Customer/Vendor Name', T1.[NumAtCard] AS 'BP Reference No.', T0.[Quantity] AS 'Quantity', T0.[Dscription] AS 'Item/Service Description', T0.[U_UDF_ForDes] AS 'UDF_ForDes', T3.[SlpName] AS 'Sales Employee Name', T1.[Address2] AS 'Ship to' FROM [dbo].[RDR1] T0 INNER JOIN [dbo].[ORDR] T1 ON T1.[DocEntry] = T0.[DocEntry] INNER JOIN [dbo].[OCRD] T2 ON T2.[CardCode] = T1.[CardCode] , [dbo].[OSLP] T3 INNER JOIN [dbo].[ORDR] T4 ON T4.[SlpCode] = T3.[SlpCode] WHERE (T1.[DocStatus] = (N'O' ) )
Any Ideas?
Thanks,
Luke