Results 1 to 2 of 2
  1. #1
    Join Date
    Aug 2011
    Posts
    3

    Unanswered: Query for getting records within 2 date values

    i have getdata() = 'Aug 17 2010'
    i need to take getdate() - 5 value into another variable

    @var1 = 'Aug 17 2010'
    @var2 = 'Aug 12 2010'


    the source table has this data

    Name Busdt
    aet 8/13/2010
    adp 8/14/2010
    add 8/10/2010
    gdd 8/11/2010
    hig 8/15/2010


    now, i need to retrieve all the records with busdt falling between var1 and var2

    how do i do this?

    Thanks in advance
    Last edited by irudayaraj; 08-18-11 at 03:30.

  2. #2
    Join Date
    May 2005
    Location
    South Africa
    Posts
    1,365
    Provided Answers: 1
    Depending if you want the time portion
    dateadd(dd,-5,getdate())
    or
    dateadd(dd,datediff(dd,'',getdate())-5,'')

Posting Permissions

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