Jump to content

Archived

This topic is now archived and is closed to further replies.

Red 09

Generating a list (archive) of each year of the entries

Recommended Posts

This is for a simple news archive.

 

I need help with a way to make a list like this:

 

2000

2001

2002

2003

(etc..)

 

Clicking on a year will display all entries posted that year.

 

The yearlist is to be extracted from news entries in a table, and each year is to occur only once in the list.

 

Could someone please help me out?

Share this post


Link to post
Share on other sites

Never mind, I figured it out:

 

SELECT DISTINCT YEAR(date) FROM articles GROUP BY date;

 

PS! It seems that YEAR() is case-sensitive. year(date) != YEAR(date) for some reason

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.