Forum

How to Write a SQL ...
 
Notifications
Clear all

How to Write a SQL Query to get all people born on the same day and month excluding the year?


Pavan NJ
Posts: 47
 Pavan NJ
Topic starter
(@Pavan NJ)
Joined: 1 year ago

Given Date is 10th October 

1 Reply
Sandeep0069
Posts: 36
 Sandeep0069
(@Sandeep0069)
Joined: 1 year ago

You have to use both day and month function. Try the below query. 

Select Name, DateOfBirth, CAST(DateOfBirth as Date) as [DatePart]

From Employees

Where Day(DateOfBirth)=10 AND Month(DateOfBirth)=10

Hope it helps. 

Reply
Share: