MySQL中的没有SQL Server中的Top函数,但是与之对应的是Limit函数,此函数包含两个参数。
offset和NumberOfReturnValues.
select NameOfColumn from NameOfTable limit offset,NumberOfReturnValues;
eg:
mysql> select ratetype from rate limit 0,4;
+----------+
| ratetype |
+----------+
| 0 |
| 1 |
| 1 |
| 1 |
+----------+
4 rows in set (0.00 sec)
offset和NumberOfReturnValues.
select NameOfColumn from NameOfTable limit offset,NumberOfReturnValues;
eg:
mysql> select ratetype from rate limit 0,4;
+----------+
| ratetype |
+----------+
| 0 |
| 1 |
| 1 |
| 1 |
+----------+
4 rows in set (0.00 sec)