Alpha Video Training
Results 1 to 2 of 2

Thread: SQL Select Statement - How to filter date

  1. #1
    Member
    Real Name
    Mark Williams
    Join Date
    Dec 2005
    Posts
    314

    Default SQL Select Statement - How to filter date

    I have a dbf application where I import records from a SQL table. I am attempting to set a filter to only import records whose date are (today-365) so it doesn't import records more than a year old.

    I have been able to define the following in the import operation and it works:

    SELECT ID, USERID, SERIAL_NUM, RECORD_DATE, RECORD_TIME, RESULT FROM Track WHERE RECORD_DATE >= '2018-04-07'

    How can I change it from a literal date to (today-365)?

    Thanks

  2. #2
    "Certified" Alphaholic
    Real Name
    Gregg Schmidt
    Join Date
    Mar 2001
    Location
    Milwaukee
    Posts
    1,351

    Default Re: SQL Select Statement - How to filter date

    Hi Mark,

    Try this :
    Code:
    SELECT ID, USERID, SERIAL_NUM, RECORD_DATE, RECORD_TIME, RESULT FROM Track WHERE RECORD_DATE >= dateadd(year,-1,left(getdate(),11))

Similar Threads

  1. Performance - base filter vs filter in select statement
    By rjackson@arach.net.au in forum Mobile & Browser Applications
    Replies: 1
    Last Post: 08-09-2016, 11:26 AM
  2. USER select date to filter an SQL based grid
    By jcarrallo in forum Mobile & Browser Applications
    Replies: 1
    Last Post: 01-30-2015, 06:17 PM
  3. Using a session variable to filter a select statement
    By jcarrallo in forum Mobile & Browser Applications
    Replies: 2
    Last Post: 07-27-2014, 02:04 AM
  4. using checkbox select filter in an SQL insert statement?
    By Pat Bremkamp in forum Application Server Version 11 - Web/Browser Applications
    Replies: 2
    Last Post: 12-17-2011, 07:07 PM
  5. Syntax for date used in Select Records Filter
    By Charlain in forum Alpha Five Version 4
    Replies: 2
    Last Post: 07-28-2003, 08:51 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •