tags:

views:

137

answers:

3

There is two field in my data base id(primary key) and name. I want arrange my data in descending order by using id

+1  A: 

SELECT * FROM your_table ORDER BY id DESC;

jkramer
+3  A: 
    SELECT [column(s)]
      FROM [table]
  ORDER BY [column(s)] [ASC, DESC];

For more information check here: http://www.sqlite.org/lang_select.html

Ardman
AFAIK if you omit ASC it will work as ascending by defeault.
Camilo Martin
Added purely to show the options ;o)
Ardman
A: 

SQL has an ORDER BY clause that allows you do order the result set by any column/columns, ascending and descending.

For your particular question:

SELECT Id, Name
FROM myTable
ORDER BY Id DESC;

See this SO question (SQLite - sorting a table).

Oded