sheraz iqbal sheraz iqbal - 1 year ago 56
SQL Question

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)


SELECT * FROM attendance WHERE date = (year-month)

Answer Source

You can set your date range from the beginning and end of that month.

    FROM attendance
    WHERE `date` BETWEEN '2015-09-01' AND '2015-09-30'