Forum

How to Write a SQL ...
 
Share:
Notifications
Clear all

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

2 Posts
1 Users
0 Likes
332 Views
Pavan NJ
Posts: 47
 Pavan NJ
Guest
Topic starter
(@Pavan NJ)
Eminent Member
Joined: 2 years ago

Given Date is 10th October 

1 Reply
Sandeep0069
Posts: 36
 Sandeep0069
Guest
(@Sandeep0069)
Eminent Member
Joined: 2 years 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

Leave a reply

Author Name

Author Email

Title *

 
Preview 0 Revisions Saved
Share: