Site Sponsored By: SQLDSC - SQL Server Desired State Configuration
Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
I have an SQL DB setup and the users field stores their date of birth in a datetime field.I have a form where I'm querying the db from and there is an "Age" field and a date field.So you could put "10" in the age field and "01/12/1999" in the date field.I want the db to return all the records from that table where the user will be 10 on that given date.I can do it so it returns all users who's birthday is in that year, but I need to make it so that it only returns records where they are that age on that given date.So for example, I have 2 people, Ben and Jerry. Ben's dob is 01/12/1999 and Jerry's is 05/12/1999.If I ran the above query and entered 10 in the age and 04/12/1999 in the date field, it should only return Ben's record, because Jerry is 10 on 5th and therefore not 10 yet.Does that make sense?