cancel
Showing results for 
Search instead for 
Did you mean: 

No data while executing

Former Member
0 Kudos
48

No data while executing this query .Please Help

Declare @FrmDate as date

Declare @ToDate as date

Declare @series as Varchar(10)

SELECT T2.[CardCode] AS 'Customer/Vendor Code', T2.[CardName] AS 'Customer/Vendor Name',

T2.[DocNum] AS 'Document Number',T3.SeriesName, T1.[SumApplied] AS 'Paid to Invoice',

T2.[DocDate] AS 'Posting Date', T0.[DocNum] AS 'Document Number',

T0.[DocDate] AS 'Posting Date'

FROM  [dbo].[OINV] T0  INNER  JOIN [dbo].[RCT2] T1  ON  T1.[DocEntry] = T0.[DocEntry] 

INNER  JOIN [dbo].[ORCT] T2  ON  T2.[DocNum] = T1.[DocNum]

INNER JOIN [dbo].[NNM1]  T3  ON T2.Series = T3.Series

WHERE T2.[DocDate]  between @FrmDate and @ToDate and T3.SeriesName = @series

Accepted Solutions (0)

Answers (1)

Answers (1)

kothandaraman_nagarajan
Active Contributor
0 Kudos

Hi,

To get result from above query, you have set values for declared variables. Try this query for date and same way try for series.

Declare @FrmDate as datetime
Declare @ToDate as datetime

Set @FrmDate = (Select min(t0.Docdate) from dbo.ORCT t0 where t0.Docdate >='[%1]')
Set @ToDate = (Select max(t1.Docdate) from dbo.ORCT t1 where t1.Docdate <='[%2]')

SELECT T2.[CardCode] AS 'Customer/Vendor Code', T2.[CardName] AS 'Customer/Vendor Name',

T2.[DocNum] AS 'Document Number',T3.SeriesName, T1.[SumApplied] AS 'Paid to Invoice',

T2.[DocDate] AS 'Posting Date', T0.[DocNum] AS 'Document Number',

T0.[DocDate] AS 'Posting Date'

FROM  [dbo].[OINV] T0  INNER  JOIN [dbo].[RCT2] T1  ON  T1.[DocEntry] = T0.[DocEntry] 

INNER  JOIN [dbo].[ORCT] T2  ON  T2.[DocNum] = T1.[DocNum]

INNER JOIN [dbo].[NNM1]  T3  ON T2.Series = T3.Series

WHERE T2.[DocDate]  between @FrmDate and @ToDate

Thanks & Regards,

Nagarajan