Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Query matching from two tables

0 Kudos
216
  • SAP Managed Tags:

Hello,

I have the following query which works.

SELECT T1.[DocNum] AS 'Document Number',

T1.[DocDate] AS 'Posting Date',

T1.[Filler] AS 'Base Stock',

T0.[ItemCode] AS 'Item No.',

T0.[Quantity] AS 'Quantity',

T0.[WhsCode] AS 'Destination Stock',

T0.[Dscription] AS 'Item/Service Description',

T1.[Comments] AS 'Comments

FROM [dbo].[WTR1] T0 INNER JOIN [dbo].[OWTR] T1 ON T1.[DocEntry] = T0.[DocEntry] WHERE T1.[DocDate] >= (CONVERT(DATETIME, '20230101', 112) ) AND T1.[Filler] = (11 )

The additional requirement is:

Compare T1.Comments from WTR with U_STN_GUID from RDR

If they are equal output T1.DocNum from RDR

I have tried the following formula which does not work:

SELECT T1.[DocNum] AS 'Document Number',

T1.[DocDate] AS 'Posting Date' FROM [dbo].[RDR1] T0 INNER JOIN [dbo].[ORDR] T1 ON T1.[U_STN_GUID] = T1.[Comments] FROM [dbo].[WTR1] T0 INNER JOIN [dbo].[OWTR]

It is best to build this requirement into the existing formula.

Thanks for your help

0 REPLIES 0