cancel
Showing results for 
Search instead for 
Did you mean: 

Relations tables - OINV and ORIN

Former Member
0 Kudos

Hi,

Is there any relation between OINV and ORIN tables?

I can see in ORIN table, field Comments, a description of this, but I need to do a query with a relation and this field is invalid for to do this transaction.

Thanks in advance!!!

Accepted Solutions (1)

Accepted Solutions (1)

Former Member

Hi Cristina,

Not between OINV and ORIN, but there is a relationship between INV1 and RIN1.

Here is the SQL to return all the Invoices that had at leat one row converted to a credit memo.


SELECT DISTINCT
	T3.DocNum AS 'Invoice Number', T3.DocDate AS 'Invoice Date', 
	T0.DocNum AS 'Credit Memo Number', T0.DocDate AS 'Credit Memo Date'
FROM 
	[dbo].[ORIN] T0 INNER JOIN
	[dbo].[RIN1] T1 ON T0.DocEntry = T1.DocEntry LEFT JOIN
	[dbo].[INV1] T2 ON T1.BaseEntry = T2.DocEntry AND T1.BaseLine = T2.LineNum AND T1.BaseType = 13 INNER JOIN
	[dbo].[OINV] T3 ON T2.DocEntry = T3.DocEntry

Regards,

Vítor Vieira

Answers (0)