Hi,
How do I make a query to get everything from 1 month ago until now?
thanks.
SQL-query everything from last month
Re: SQL-query everything from last month
You can add some special functions,
but they depend on what type of Database Management System (DBMS) you use.
For mysql:
for SQL server:
Not sure how it is in PostgreSQL and oracle,
but I'm sure it something similar.
but they depend on what type of Database Management System (DBMS) you use.
For mysql:
Code: Select all
SELECT * FROM table WHERE datefield > DATE_SUB(NOW(), INTERVAL 1 MONTH);
Code: Select all
SELECT * FROM table WHERE datefield > DATEADD(m, -1, GETDATE());
but I'm sure it something similar.