Click here to Skip to main content
15,886,362 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
Hello sir,
In my project a table having a column BirthDate.I want to show only the records whose age<=58.I have not age column.
plz send the code with datediff().
Plz,plz .............
So Urgent.
Posted

Hi
select DATEDIFF(YEAR,DataofBirth,GETDATE())from <tablename>where DATEDIFF(YEAR,DataofBirth,GETDATE())<=58.
 
Share this answer
 
Select [fields] from <tablename> where Datediff(YEAR,DataofBirth,Getdate())<=58


You can then bind this to your UI control (like grid)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900