我有以下查询:
SELECT COUNT(*) from (select id, name from table1) as "t" limit 10 offset 10;
以上返回:
count(*)
________
如果我运行以下程序:
SELECT * from (select id, name from table1) as "t" limit 10 offset 10;
6个结果。
id name
1 name1
2 name2
. .
. .
. .
6 name6
发生了什么事?我希望看到count(*(:6,因为这是第二个查询中的行数。我所做的就是数它们。
offset 10
因为你已经把它放在最后了,这意味着跳过前10行;选择计数";查询只返回一行,所以您不会得到结果