How to get current year rows using MySql Query PHP?By Hardik Savani | June 14, 2016 | | 1719 Viewer | Category : MySql
If you require to get all the records of current year 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 year. 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 year.
SELECT * FROM items WHERE created_at > DATE_SUB(NOW(), INTERVAL 1 YEAR);
- How to get user agent value in Laravel 5?
- PHP MySQL - Simple Image Gallery CRUD example from scratch
- Codeigniter - How to get current url in controller or view ?
- How to create middleware with parameters in Laravel 5?
- Solved - gulp error cannot find module laravel-elixir
- How to implement infinite ajax scroll pagination in Laravel 5?
- How to use groupby having with DB::raw in Laravel Query Builder?
- Laravel 5 - Confirmation before delete record from database example