Search code examples
visual-foxprofoxpro

Select query for viewing data in specific data rang in FoxPro database


In foxpro database, how to write select query for viewing data in specific time range. Can anyone show an example.


Solution

  • You just write it as you would do with any SQL database. The only thing that differs is the parameters' syntax. For example below query retrieves all the transactions made in, say July 2020:

    local ltFrom, ltUpTo
    ltFrom = DateTime(2020,7,1)
    ltUpTo = DateTime(2020,8,1) && Midnight
    
    select * from myTable ;
       where transactionDatetime >= ?m.ltFrom and  ;
             transactionDatetime < ?m.ltUpTo ;
       into cursor crsResult ;
       nofilter
    browse