Can anyone tell me How to Write a SQL Query to get all people born on Yesterday?
Jul 28, 2020 6:57 am
How to achieve this SQL Query to get all people born on Yesterday
Jul 28, 2020 10:42 am
Let us do some workaround to achieve this.
Select (GETDATE) Will give us the current Date with the timestamp
To Avoid timestamp we can use CAST Function
Select CAST(GETDATE() as Date) will give us the date without a timestamp.
Final Query Query
Select DATEADD(Day,-1,CAST(GETDATE() as Date)) as [Datepart]
Where CAST(DateOfBirth as Date) = DateADD(Day,-1, CAST(GETDATE() as DATE)