Results 1 to 3 of 3

Thread: SQL Query

  1. #1
    Join Date
    Apr 2011
    Posts
    8

    SQL Query

    Can anybody help me in retrieving the data from specified date to 30 days ago in sql. I tried using [date] >= dateadd(d,datediff(d,0,'2011-03-28'),-30),, but its retrieving records till current date. I want to retrieve data only till 28 march from 30 days ago i.e. 28 Feb or 1st march.

    Welcome for all suggestions

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    WHERE datetimecolumn BETWEEN DATEADD(D,-30,'2011-03-28') AND '2011-03-28'
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  3. #3
    Join Date
    Apr 2011
    Posts
    8

    thankyou

    Ya. It worked well. Thank you

Posting Permissions

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