TheDeveloper TheDeveloper - 1 year ago 59
SQL Question

Checking Values Stored In A Column In A Date of Birth Format in Database

I am currently trying to get all records in a database that have a date of birth set to a future date. But I am not sure how to check the existing values stored and make sure they are greater than/less than today's date.

Currently all I have is,

select * from [table_name]
where [column_name] = .........;

the formats of the saved dates are DD-FEB-YY and they are stored in a column within a person table.

Answer Source

Use the CURDATE() function to get today's date. This will return all records later than today:

SELECT * FROM table WHERE dateColumn > CURDATE()
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download