我用的是POSTGRESQL.select name from t_personal order by personal_id desc 我想取得上面结果数据的,前10条记录.SQL语句怎么改. 我记得好象SQLSERVER是.select top 10 ....,什么的.谁知道POSTGRESQL怎么写 select name from t_personal order by personal_id desc limit 10
常见数据库SELECT结果只显示前几条记录方法汇总 为了查看数据表中的数据情况.经常会遇到想让查询结果只显示N行,比如只显示10行的情况.不同的数据库有不同的关键字和SELECT实现语法. 1.SQL Server数据库select top 10 * from table_name; 2.DB2数据库select * from table_name fetch first 10 rows only; 3.Oracle数据库select * from table_name where rownu
福哥答案2020-07-06:表a和表b的字段都是id和tid,数据类型都是int.查询结果顺序上以 表a 为准.1.JOIN.SELECT * FROM a JOIN b ON a.tid = b.tid LIMIT 200 OFFSET 500002.子查询.SELECT * FROM (SELECT ROW_NUMBER() OVER (ORDER BY T.tid) AS num, T.*FROM(SELECT a.id AS aid,a.tid,b.id AS bidFROM b JO
1.如果A表TID是自增长,并且是连续的,B表的ID为索引 select * from a,b where a.tid = b.id and a.tid>500000 limit 200; 2.如果A表的TID不是连续的,那么就需要使用覆盖索引.TID要么是主键,要么是辅助索引,B表ID也需要有索引. select * from b , (select tid from a limit 50000,200) a where b.id = a .tid;