MySQL Forums
Forum List  »  General

SELECT DISTINCT For Month and Year?
Posted by: James Maxon
Date: February 08, 2005 10:29AM

I am using ASP with MySQL. I want to only display 1 record for each month and year.

For Example I want it to show:

» February 2005
» January 2005
» December 2004
» November 2004

But right now it is displaying all the entries like this:

» February 2005
» February 2005
» February 2005
» February 2005
» February 2005
» January 2005
» January 2005
» January 2005
» January 2005

I have tried the: mySQL = "SELECT DISTINCT * FROM table"

But because I am calling the date and month but not the day I think this will not work. For example a date looks like 2004-12-25, and the next one 2004-12-26. But I want only a DISTINCT record for the 2004-12.

Is this possible? If so how?

Thanks,
- James

Options: ReplyQuote


Subject
Written By
Posted
SELECT DISTINCT For Month and Year?
February 08, 2005 10:29AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.