My table contains a DATE Field that is time stamped and I want to query on anything that was added to the db in the last 30 days. What would be the proper mySQL syntax for that?

I tryed this but it didn't work.

$query ="SELECT * FROM table_name WHERE DATE<=(NOW()-30)";

    check out INTERVAL on the mysql manual

    here

    Think it's DATE INTERVAL 30 DAYS or DAY

    Sam

      if your DATE field is a mySQL timestamp:

      SELECT * FROM table_name WHERE UNIX_TIMESTAMP(DATE) >= UNIX_TIMESTAMP() - 2592000

      if it's a UNIX timestamp:

      SELECT * FROM table_name WHERE DATE >= UNIX_TIMESTAMP() - 2592000
        Write a Reply...