SQL Question: Date subtraction
How would you write a SQL statement to return rows between a specific date and that same date minus a user entered number of days.
So I wanted records from 12/25/2001 and 45 days prior. The date and the number of days is user entered.
Just thought I throw this question in here and then start hunting for answers elsewhere. It'll be good warm up brain exercises for those in the know
often you can convert the time to an integer, which represents the number of milliseconds since a given system date, such as 1-1-1970. Subtract 45 * 24 * 36000 from this number and you will have the number of milliseconds from 1970 of your new date. Convert this number back to a date.