Jherom Ocado De Jesus
Jherom Ocado De Jesus

Reputation: 35

Mysql query: filtering records MM from YYYYMMDD

I want to filter records based on the month of the available due date.

I am trying with the following query but It's not working.

SELECT * FROM m_bills WHERE due_date LIKE substr('201704',4,2)

in this example, I just want to filter all records with the month of April "04".

Upvotes: 0

Views: 35

Answers (1)

Rajat Gupta
Rajat Gupta

Reputation: 340

Use Query Like this select * from m_bills where monthname(due_date) = 'April'

monthname function

Upvotes: 1

Related Questions