如何在mysql中选择前10条记录

In my database have 100 records but i want only first 10 records in descending order not for whole database in descending order.

Ex: Database:Records

 1,2,3,4,5,6,,7,8,9,10,11,12....................100.

First 10 Records:

10,9,8,7,6,5,4,3,2,1

You can use this query:

SELECT * FROM (SELECT * FROM table ORDER BY * ASC LIMIT 10) 
ORDER BY * DESC ;

Use limit.

Use LIMIT. See the mySQL manual on SELECT

For example:

SELECT id FROM tablename ORDER BY ID LIMIT 0,10

the turning around of the results like you show is then probably best done in PHP using array_reverse(), I can't think of a easy mySQL way to do this.

If I understand your question correctly,

SELECT x FROM (SELECT x FROM table ORDER BY x ASC LIMIT 10) ORDER BY x DESC

The SELECT in parentheses selects the first 10 records (by ascending x) and the outer SELECT sorts them in the order you want.

Use LIMIT. See the mySQL manual on SELECT

For example:

SELECT id FROM tablename ORDER BY ID LIMIT 0,10

The turning around of the results like you show is then probably best done in PHP using array_reverse(), I can't think of a easy MySQL way to do this.