devxlogo

Sort by date

Sort by date

Question:
In a project tracking database, one of the columns in a table contains the date in this format: MM/DD/YY. I would like to be able to see a listing of projects that are overdue. Is it possible to query the table so that the SQL statement returns only records with dates before the current date? How do I retrieve today’s date?

Answer:
I’ll assume that the field you are talking about is defined as a date. (If not, you will have to use either the convert function or some of the string functions with the convert to have it treated as a date). You could then simply say:

 select * from projectswhere projdate < getdate() 

?getdate returns today's date

See also  5 Tips to Manage a Remote Workforce
devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist