Skip to Content
0
Former Member
Jan 06, 2012 at 09:29 AM

wrong result in query.

35 Views

Hi, SAP gurus,

i am creating a aging query on Service Call, to return Calls pending between specified days..

to get days, i used

where  datediff(day, oscl1.createdate,getdate()) >= 0 and 100

below executed query is working fine...

Select
oscl1.callid,
oscl1.custmrname,
oscl1.itemcode,
oscl1.itemname,
oscs.name,
datediff(day,oscl1.createdate,getdate()) 'Pending (Days)'
from oscl oscl1
inner join oscs on 
oscs.statusid = oscl1.status
where datediff(day,oscl1.createdate,getdate()) between  0 and 100
and oscl1.status!=-1

now i am trying to accept days from user

for that i wrote

where datediff(day,oscl1.createdate,getdate()) between  [%0] and [%1]

but the above clause is not getting executed...

below is my code

--query not getting executed.
Select
oscl1.callid,
oscl1.custmrname,
oscl1.itemcode,
oscl1.itemname,
oscs.name,
datediff(day,oscl1.createdate,getdate()) 'Pending (Days)'
from oscl oscl1
inner join oscs on 
oscs.statusid = oscl1.status
where datediff(day,oscl1.createdate,getdate()) between  [%0] and [%1] '-- not getting execute this clause.
--where oscl1.createdate  between  [%0] and [%1] '-- this clause is working fine.
and oscl1.status!=-1

but in where clause if i give condition like

where oscl1.createdate  between  [%0] and [%1]

the above clause is working fine,

does any one know where i am doing wrong in this query..?

i appreciate your help..

Thanks and Regards,

kaviprashu