Subject Re: SQL where with date variable
From Akshat Kapoor <akshat.kapoor@kapoorsons.in>
Date Thu, 21 Nov 2019 14:51:44 +0530
Newsgroups dbase.getting-started

On 21/11/2019 14:38, Robbie Nott wrote:
> Dear dBase
>
> Trying to create an SQL statement
>
> d = Date()
> Select * from AccTran where TranDate < d
>
> Please help
> Thanks


Good Afternoon Robbie,
select * from day18 where ddate >"20190401"
select * from day18 where ddate >{2017.04.01}
select * from day18 where ddate >{01.04.2017}

All of the above statements give error
But I do not get any error in any of the following
In fact query with parameters are my first preference

q = new query()
q.sql = "select * from day18 where ddate >:xdate"
q.params["xdate"] = date()
q.active = true
q.params["xdate"] = date()-10
q.requery()

I hope this helps
Regards
Akshat