Hasif Subair
Hasif Subair

Reputation: 436

How to find all rows for a particular month independent of year in mysql

I have a user table with 3 columns say

id name dateOfBirth

where dateOfBirth is of the type DATE. Now I want to find all the people celebrating their birthday in March irrespective of the year they where born. How can it be done.

Upvotes: 1

Views: 864

Answers (4)

I Perfect
I Perfect

Reputation: 389

SELECT * FROM table_name WHERE MONTH(date_column) = 3;

Upvotes: 4

X-Factor
X-Factor

Reputation: 2117

I think this will be helpful.

SELECT * FROM table WHERE MONTH(date) = 3

Regards.

Upvotes: 2

SteveP
SteveP

Reputation: 19093

Use the month function

Where month(dateofbirth) = 3

Upvotes: 3

MarcinJuraszek
MarcinJuraszek

Reputation: 125620

MySql has Month function:

WHERE MONTH(dateOfBirth) = 3

Upvotes: 2

Related Questions