Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need a list of years from dates

Status
Not open for further replies.

Chloeee

Programmer
Jan 16, 2001
27
0
0
US
I need to populate a select box with the years available from a database. The full dates are stored in the database, but I just need the years(no duplicates, of course). I don't care if they come directly from my query, or if I have to do some manipulation in CF before I use them. I just need them! There is one record for each day. Any ideas? Here is my current query, that obviously, doesn't do much except return all record dates...
Code:
SELECT IncidentDate FROM Incident
 
If you only want to pull individual years in the query, you can do this:
Code:
SELECT DISTINCT YEAR(IncidentDate) AS incidentYear
FROM Incident
ORDER BY incidentYear
This will return all the years (with no duplicates) in your Incident table. Kevin
slanek@ssd.fsi.com
 
That works perfectly; thank you so much!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top