开发者

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

开发者 https://www.devze.com 2023-01-25 14:26 出处:网络
I have table named usertable and structure is idNameYear ========================== 1a2010 ____________________________

I have table named usertable and structure is

     id     Name        Year
   ==========================
     1       a          2010
  ____________________________
     2       b          2008
  ____________________________
     3       c          2010
  ____________________________
     4       d          2007
  ____________开发者_C百科________________
     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.


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;


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


SELECT DISTINCT Year
FROM MyTable
ORDER BY Year DESC


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

0

精彩评论

暂无评论...
验证码 换一张
取 消