Jump to content


Photo

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


  • Please log in to reply
1 reply to this topic

#1 Red 09

Red 09
  • Members
  • Pip
  • Newbie
  • 5 posts
  • LocationNorway

Posted 08 December 2003 - 08:06 AM

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?
- Red -

#2 Red 09

Red 09
  • Members
  • Pip
  • Newbie
  • 5 posts
  • LocationNorway

Posted 08 December 2003 - 08:40 AM

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
- Red -




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users