Forum

How to Write a SQL ...
 
Notifications
Clear all

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


Pavan NJ
Posts: 47
 Pavan NJ
Topic starter
(@Pavan NJ)
Joined: 1 year 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. 

Topic Tags
1 Reply
Sandeep0069
Posts: 36
 Sandeep0069
(@Sandeep0069)
Joined: 1 year 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
Share: