Reputation: 99
I have table named usertable and structure is
id Name Year
==========================
1 a 2010
____________________________
2 b 2008
____________________________
3 c 2010
____________________________
4 d 2007
____________________________
5 e 2008
Now I want the Output result like this
Year
==========
2010
____________
2008
____________
2007
I don't know the SQL query .
So please help me.
Every Ideas and suggestions are welcome.
Upvotes: 0
Views: 90
Reputation: 4190
Not exactly sure what you're looking for, but if you're looking for the years that are in the table in descending order, then you could use this:
SELECT DISTINCT year FROM usertable ORDER BY year DESC;
Upvotes: 2
Reputation: 12704
SELECT DISTINCT Year
FROM TABLE
ORDER BY Year DESC
if you wan't to be more than tape monkey here's a brilliant hands on source http://sqlzoo.net/0.htm
Upvotes: 0