Hi Guys,
I am trying to run this query in SAP B1:
SET ARITHABORT OFF
SET ANSI_WARNINGS OFF
/**SELECT FROM [OJDT] T2**/
declare @DocDateFrom as datetime
/* WHERE */
set @DocDateFrom = /* T2.Refdate */ '[%0]'
/**SELECT FROM [OJDT] T2**/
declare @DocDateTo as datetime
/* WHERE */
set @DocDateTo = /* T2.Refdate */ '[%1]'
select T0.[AcctCode], T0.[AcctName], T0.[CurrTotal] ,T2.[RefDate] ,
T1.[ContraAct] ,T2.[Number] , T1.[BaseRef] ,T1.[Ref1] ,T2.[Memo], T2.[LocTotal]
from OACT T0 INNER JOIN JDT1 T1 On T0.Acctcode = T1.Account LEFT JOIN OJDT T2 ON T1.BaseRef=t2.BaseRef
where T2.[RefDate] >= @DocDateFrom and T2.[RefDate] <= @DocDateTo
and T0.[AcctCode] LIKE '691%' or T0.[AcctCode] LIKE '6228%'
order by T2.[RefDate]
But when I put the two dates, it returns all the dates, ignoring the range.