MySQL Forums
Forum List  »  Newbie

Nested SELECT
Posted by: it99ama
Date: April 12, 2005 01:41PM

Hi!
I'm new to MySQL and want to do a nested SELECT statement.

I want to get all years stored in the database except the last year:
(content is the table and null values exists)

SELECT DISTINCT YEAR(content.date)
FROM content
WHERE(((YEAR(content.date)) IS NOT null)) AND YEAR(content.date) < (SELECT YEAR(MAX (content.date)) FROM content))
ORDER BY YEAR(content.date) DESC

What is wrong?


Is there an easier way to do this?

Regards
/Anders :-)

Options: ReplyQuote


Subject
Written By
Posted
Nested SELECT
April 12, 2005 01:41PM
April 12, 2005 01:48PM
April 12, 2005 01:56PM
April 13, 2005 10:36AM


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.