postgresql的分页显示-截取字符串-递归查询

=======================================
>>>>>>>>>>>>>>postgresql<<<<<<<<<<<<<<<
=======================================
1.pgsql 分页查询
---------------------------------
select * from table_name limit A offset B
注:A为所需展示的行数
B为查询的起始位置
---------------------------------------
select * from table_name where id >B limit A
========================================
2.pgsql 截取字符串函数
----------------------------------
给定子字符串在字符串中的位置 position ('源字符串','子字符串')
截取字符串 substring('源字符串' from 起始位置 for 截取字符串长度);
substring('源字符串',A,B);
注:A:起始位置 B.截取长度
==========================================
3.pgsql 递归查询
------------------------------------
从根节点往子节点查询:
with recurse result as(
select id,pid,name from js_city where id=1
union all
select a.id,a.pid,a.name from js_city a join result b on b.id= a.pid)
select id,pid,name from result;

猜你喜欢

转载自blog.csdn.net/weixin_36355899/article/details/76915445
今日推荐