Thursday, December 8, 2011

How do i create a mysql statement that will show me date between 5 days ago and now?

select {Fieldnames} from {tablename}


where {DateFieldname} %26gt;= getDate()-5





The term "GetDate" returns today's date from the computer and the -5 will subtract 5 days. So, you will be looking at anything equal to or greater than 5 days ago.

No comments:

Post a Comment