last 10 ... 30 ... 60 days

Results 1 to 4 of 4

Thread: last 10 ... 30 ... 60 days

  1. #1
    Join Date
    Dec 1969
    Posts
    572

    Default last 10 ... 30 ... 60 days

    Hi guys, plese,<BR>how to run query to return only last<BR>10 or 30 or so on days from db.<BR>Thanks

  2. #2
    Jairo Guest

    Default RE: last 10 ... 30 ... 60 days

    Alex,<BR>In SQL Server, use datediff().<BR>select * from YOURTABLE<BR>where datediff(dd, transaction_date, getdate() ) = 30<BR><BR>HTH,<BR>Jairo<BR>http://www.citywebarchitects.com

  3. #3
    Join Date
    Dec 1969
    Posts
    572

    Default RE: last 10 ... 30 ... 60 days

    Jairo,<BR>I am using Access,<BR>What can I use for Access, please!

  4. #4
    Jairo Guest

    Default RE: last 10 ... 30 ... 60 days

    Alex,<BR>For MS-Access, use DateAdd() instead.<BR><BR>select * from YourTable<BR>where transaction_date &#062; DateAdd(&#039d&#039, -30, Date())<BR><BR>HTH,<BR>Jairo<BR>http://www.citywebarchitects.com


Posting Permissions

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