Forum

How to Write a SQL ...
 
Notifications
Clear all

How to Write a SQL Query to get all people born on given dates?


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

Dates are given here 01-Jan-2019 and 31-Dec-2019

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

Use the date between function to achieve this.

 

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

From Employees

Where CAST(DateOfBirth) Between '2019-01-01' AND '2019-12-31'

Reply
Share: