Ding Dong
Ding Dong

Reputation: 99

How To Get The Value Single Time From A Column at Sql Table

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

Answers (4)

MikeTheReader
MikeTheReader

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

Unreason
Unreason

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

JNK
JNK

Reputation: 65187

SELECT DISTINCT Year
FROM MyTable
ORDER BY Year DESC

Upvotes: 0

Brad
Brad

Reputation: 15577

SELECT DISTINCT [Year]
FROM   myTable
ORDER BY [Year] DESC

Upvotes: 0

Related Questions