Forum

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

How to Write a SQL Query to get all people whose birth year is the same (2019,2020 e.t.c)

2 Posts
1 Users
0 Reactions
1,049 Views
Posts: 46
Topic starter
(@Pavan NJ)
Joined: 6 years ago

Any year like 2019 or 2020. 

I want to capture all people whose birth yer is the same from a table. Consider employee table. 


1 Reply
Posts: 36
(@Sandeep0069)
Joined: 6 years ago

I choose in 2019 . You can also use In List to get both the year's data.

 

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

From Employees

where Year(DateOfBirth)='2019'


Reply

Leave a reply

Author Name

Author Email

Title *

 
Preview 0 Revisions Saved
Share: