8 个解决方案
#1
SELECT TOP 10 B FROM A ORDER BY B DESC
#2
select top 10 * from a order by B desc
go
go
#3
+----------------+-------------+------+-----+---------------------+-------+
| Field | Type | Null | Key | Default | Extra |
+----------------+-------------+------+-----+---------------------+-------+
| UserID | varchar(10) | | PRI | | |
| LastUpdateTime | datetime | | | 0000-00-00 00:00:00 | |
+----------------+-------------+------+-----+---------------------+-------+
+--------+---------------------+
| UserID | LastUpdateTime |
+--------+---------------------+
| 19038 | 2003-10-26 10:58:25 |
| 19042 | 2001-10-10 10:10:10 |
| 19041 | 2003-10-20 10:38:24 |
| 11221 | 2000-01-01 12:00:00 |
+--------+---------------------+
表是这样的。
输入 select TOP 5 UserID from user order by desc;
输出 ERROR 1064: You have an error in your SQL syntax. Check the manual that corresp
onds to your MySQL server version for the right syntax to use near '5 UserID fro
m user order by desc' at line 1。
| Field | Type | Null | Key | Default | Extra |
+----------------+-------------+------+-----+---------------------+-------+
| UserID | varchar(10) | | PRI | | |
| LastUpdateTime | datetime | | | 0000-00-00 00:00:00 | |
+----------------+-------------+------+-----+---------------------+-------+
+--------+---------------------+
| UserID | LastUpdateTime |
+--------+---------------------+
| 19038 | 2003-10-26 10:58:25 |
| 19042 | 2001-10-10 10:10:10 |
| 19041 | 2003-10-20 10:38:24 |
| 11221 | 2000-01-01 12:00:00 |
+--------+---------------------+
表是这样的。
输入 select TOP 5 UserID from user order by desc;
输出 ERROR 1064: You have an error in your SQL syntax. Check the manual that corresp
onds to your MySQL server version for the right syntax to use near '5 UserID fro
m user order by desc' at line 1。
#4
select top 10 * from A order by B desc
#5
还有就是数据库是My-Sql,偶好像发错地方了
#6
select TOP 5 UserID from user order by UserID desc;
还是
select TOP 5 UserID from user order by LastUpdateTime desc;
还是
select TOP 5 UserID from user order by LastUpdateTime desc;
#7
试过了,都不行
#8
mysql和mssql不一样。到mysql版问问。
#1
SELECT TOP 10 B FROM A ORDER BY B DESC
#2
select top 10 * from a order by B desc
go
go
#3
+----------------+-------------+------+-----+---------------------+-------+
| Field | Type | Null | Key | Default | Extra |
+----------------+-------------+------+-----+---------------------+-------+
| UserID | varchar(10) | | PRI | | |
| LastUpdateTime | datetime | | | 0000-00-00 00:00:00 | |
+----------------+-------------+------+-----+---------------------+-------+
+--------+---------------------+
| UserID | LastUpdateTime |
+--------+---------------------+
| 19038 | 2003-10-26 10:58:25 |
| 19042 | 2001-10-10 10:10:10 |
| 19041 | 2003-10-20 10:38:24 |
| 11221 | 2000-01-01 12:00:00 |
+--------+---------------------+
表是这样的。
输入 select TOP 5 UserID from user order by desc;
输出 ERROR 1064: You have an error in your SQL syntax. Check the manual that corresp
onds to your MySQL server version for the right syntax to use near '5 UserID fro
m user order by desc' at line 1。
| Field | Type | Null | Key | Default | Extra |
+----------------+-------------+------+-----+---------------------+-------+
| UserID | varchar(10) | | PRI | | |
| LastUpdateTime | datetime | | | 0000-00-00 00:00:00 | |
+----------------+-------------+------+-----+---------------------+-------+
+--------+---------------------+
| UserID | LastUpdateTime |
+--------+---------------------+
| 19038 | 2003-10-26 10:58:25 |
| 19042 | 2001-10-10 10:10:10 |
| 19041 | 2003-10-20 10:38:24 |
| 11221 | 2000-01-01 12:00:00 |
+--------+---------------------+
表是这样的。
输入 select TOP 5 UserID from user order by desc;
输出 ERROR 1064: You have an error in your SQL syntax. Check the manual that corresp
onds to your MySQL server version for the right syntax to use near '5 UserID fro
m user order by desc' at line 1。
#4
select top 10 * from A order by B desc
#5
还有就是数据库是My-Sql,偶好像发错地方了
#6
select TOP 5 UserID from user order by UserID desc;
还是
select TOP 5 UserID from user order by LastUpdateTime desc;
还是
select TOP 5 UserID from user order by LastUpdateTime desc;
#7
试过了,都不行
#8
mysql和mssql不一样。到mysql版问问。