select * from TB1 where DATEFIELD > 'NOW - 10 DAYS'; Replace datefield with the field that has the date, and you can fill in between the '' with the ASP datecompare code now - 10 day
Thanks, But your SQL I used It is very strange. it worked for MSsql but not worked for MySQL for MySQL it still shows example 8/1/2009 5:42:23 AM info Does it mean datetime settings are different for MsSQL and MySQL? I still need helps.
What is the data type of the date field? Is it just a text or varchar, or is it date (or datetime). If it is just text or varchar, I don't believe there is no way to do date functions on the data. My understanding is the field would have to be in a date (or datetime) format. For my datetime fields in Classic ASP and MySQL, I use SELECT * FROM TableName WHERE DATE_SUB(CURDATE(),INTERVAL 10 DAY) <= DateFieldName This would grab all records for 10 days, up to and including today's date.
Please tell me where to put DateFieldName Is this one? SELECT * FROM TableName WHERE DateFieldName > DATE_SUB(CURDATE(),INTERVAL 10 DAY)
SELECT * FROM TableName WHERE DATE_SUB(CURDATE(),INTERVAL 10 DAY) <= DateFieldName Replace "TableName" with the name of your Table, and replace "DateFieldName" at the end when the name of your Date Field. This will get you the last 10 Days of records from the Current Date. So if the date is August 30, this will give you all records from August 21 to August 30 - 10 days.