I’m trying to create a filter in ASP.net, where a user can select a certain age and an SQL statement is to return all users who are currently this age, based on a ‘DOB’ (date of birth) field.
So, for example, lets say that I have a variable age which currently holds 23. I’ve got a field in the database called ‘DOB’, of type ‘date’. How would an SQL statement be written to return all records whose date of birth indicate that they are 23? The DOB format is in YYYY-MM-DD.
Thanks
just change 37 to 23 on your end or better yet use a variable
Here is an example you can run
You can also use this more convoluted WHERE clause