Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Select specific data from date field

I am trying to get some record from table for specific month and year and I have only complete date field.

enter image description here

In the above image I want to select the data from date but only for (2015-09)

E.g.:

SELECT * FROM attendance WHERE date = (year-month)
like image 411
sheraz iqbal Avatar asked Feb 15 '26 06:02

sheraz iqbal


1 Answers

You can use year and month function:

SELECT * FROM attendance WHERE year(`date`) = '2015' and month(`date`) = '9'
like image 189
Blank Avatar answered Feb 16 '26 21:02

Blank