MySQL Query to Get Current Month Data Example
If you require to get all the records of current month using mysql query. for example you have one table "items" and columns are id, title, description, created_at and update_at, Now you want to get all records of this month. so you can fetch fields value using DATE_SUB and INTERVAL of mysql. In following example you can see how to select data of current month.
SELECT * FROM items WHERE created_at > DATE_SUB(NOW(), INTERVAL 1 MONTH);
I hope it can help you...
We are Recommending you
- PHP MySQL Contact US Form with Validation Example
- How to Get Last Record in Codeigniter?
- How to Get Filename from File Path in MySQL Query?
- PHP Import Excel File into MySQL Database Tutorial
- MySQL Query to Get Current Year Data Example
- How to Rename Column Name Foreign Key Constraint in MySQL Query?
- How to Add MySQL Trigger from Migration in Laravel?
- How to Import CSV File using MySQL?
- How to fetch this week records in MySql ?
- How to Check Empty or Null Data using MySQL Query?
- How to Copy One Table Data into Another Table using MySQL?
- How to count unique domains from email address field in MySQL ?
- Which MySQL Datatype use for Store an IP Address?