另帮忙把下面的语句改为按时间查询最近1000条记录
SELECT DISTINCT * FROM basetuple WHERE ckpointid='"+ckPointID+"' " +
" ORDER BY cktime LIMIT " + limit + " OFFSET " + offset;
表结构为ckpointid(varchar 16);cktime(datatime);timeperature(double) 先谢谢
SELECT DISTINCT * FROM basetuple WHERE ckpointid='"+ckPointID+"' " +
" ORDER BY cktime LIMIT " + limit + " OFFSET " + offset;
表结构为ckpointid(varchar 16);cktime(datatime);timeperature(double) 先谢谢
" ORDER BY cktime LIMIT 1000 order by time desc"
With two arguments, the first argument specifies the offset of the first row to return, and the second specifies the maximum number of rows to return. The offset of the initial row is 0 (not 1): SELECT * FROM tbl LIMIT 5,10; # Retrieve rows 6-15
高手能解释下OFFSET的用法吗
mysql> select * from table LIMIT 5,10; # Retrieve rows 6-15如果给定一个参数,它指出返回行的最大数目。 mysql> select * from table LIMIT 5; # Retrieve first 5 rows换句话说,LIMIT n等价于LIMIT 0,n。
LIMIT [offset,] rows
OFFSET
第一个指定要返回的第一行的偏移量,第二个指定返回行的最大数目。初始行的偏移量是0(不是1)。