1.2、row_number() —返回行号,不分组
postgres=# select row_number() over(),* from bills limit 2;
row_number | id | goodsdesc | beginunit | begincity | pubtime | amount
------------+----+-----------+-----------+-----------+---------------------+---------
1 | 1 | 衣服 | 海南省 | 三亚市 | 2015-10-05 09:32:01 | 1915.86
2 | 2 | 建筑设备 | 福建省 | 三明市 | 2015-10-05 07:21:22 | 2022.31
(2 rows)
postgres=# select row_number() over(),* from bills limit 2 offset 2;
row_number | id | goodsdesc | beginunit | begincity | pubtime | amount
------------+----+-----------------------+-----------+-----------+---------------------+---------
3 | 6 | 5 0铲车,后八轮翻斗车 | 河南省 | 三门峡市 | 2015-10-05 07:53:13 | 1030.9
4 | 8 | 旋挖附件38吨 | 河南省 | 三门峡市 | 2015-10-05 10:48:38 | 5365.04
(2 rows)