- Instant help with your Sql coding problems

Get last 30 days records in MySQL

Question:
How to get last 30 days records in MySQL?
Answer:
SELECT * FROM user_account
WHERE last_login_date > NOW() - INTERVAL 30 DAY; 
Description:

The interval_expression represents a temporal interval. Intervals have this syntax:

INTERVAL expr unit

expr represents a quantity.

unit represents the unit for interpreting the quantity; it is a specifier such as HOUR, DAY, or WEEK.

The INTERVAL keyword and the unit specifier are not case sensitive.

Temporal arithmetic also can be performed in expressions using INTERVAL together with the + or - operator.

Share "How to get last 30 days records in MySQL?"