可以这样写: 比如你要取从m条起n条记录: select Top n from table where id>(select max(id) from (select top m from table))
hehe 好办法 就这样了 谢谢苯苯
不行啊 语法错误了 不能 select max(id) from (select top m from table) 好象from后只能接表名有谁能帮我?
select max(id) from (select top m id from table)
?????? from 可以直接接 (select top m id from table) 吗? 好象不能把???请有人能详细说说
我曾经做过类似程序。 比如FIndex is primary key set m_KeyRs = "Select FIndex From <tablename> Order by FIndex " set m_DetaiRs = "Select * from <tablename> where FIndex = <FindexValue>"分屏显示: <row = From lBeginRow To lEndRow> example: m_keyrs.movefirst m_KeyRs.move lBeginRow -1 For lIndex = 1 to lEndRow - lBeginRow <...写入FlexGrid显示> m_KeyRs.MoveNext next 方案二: 建立临时表,有一Identity字段,再根据该字段过滤
不好意思,我写错了。。 应该是 select Top n * from table where id>(select max(id) from (select top m id from table))就可以了。
如果还不行。 用下面的 select Top n * from table where id>(select max(id) from (select top m from table) as new_table)
如果是oracle 你可以这样写 select * from (select * from tablename order by id) a where rownum<40 minus select * from (select * from tablename order by id) a where rownum>21 如果是sql server 你可以这样写 select top 20 * from (select top 40 * from tablename order by id) order by id asc 其实方法很多啊 如果是变量你可以用 动态sql 例如 俄execute("select top "+convert(varchar(2),@kkk-@kk)+" * from (select top "+convert(numeric(2,0),@kkk)"+" iid as iiid from tablename order by iid) b order by b.iiid asc");
to :magicpower 类似 Select * from (select * from Table) 这样的查询语句 支不只支持,与你使用的连接引擎有关! 如果你是用的Delphi的BDE的话就不支持! 如果是ODBC的话就可以!!!试试用ODBC设置DNS!
sql server 应为: select top 20 * from (select top 40 * from tablename order by id)as t1 order by id asc
解决分页显示的问题 一个dbgird显示过多数据也不方便看啊
比如你要取从m条起n条记录:
select Top n from table where id>(select max(id) from (select top m from table))
好象from后只能接表名有谁能帮我?
from 可以直接接 (select top m id from table) 吗?
好象不能把???请有人能详细说说
比如FIndex is primary key
set m_KeyRs = "Select FIndex From <tablename> Order by FIndex "
set m_DetaiRs = "Select * from <tablename> where FIndex = <FindexValue>"分屏显示:
<row = From lBeginRow To lEndRow>
example:
m_keyrs.movefirst
m_KeyRs.move lBeginRow -1 For lIndex = 1 to lEndRow - lBeginRow
<...写入FlexGrid显示>
m_KeyRs.MoveNext
next
方案二:
建立临时表,有一Identity字段,再根据该字段过滤
先取得 m_KeyRs
在分屏显示时,取得 lBeginRow , lEndRow
Call ShowRsGrid(lBeginRow,lEndrow)
'手工去填写FlexGrid
'或者手工新建一个无源的m_TempRs,然后将m_keyrs相应值插入m_TempRs,再Set DBGrid.Recordset = m_temprs
应该是
select Top n * from table where id>(select max(id) from (select top m id from table))就可以了。
用下面的
select Top n * from table where id>(select max(id) from (select top m from table) as new_table)
你可以这样写
select * from (select * from tablename order by id) a where rownum<40
minus
select * from (select * from tablename order by id) a where rownum>21
如果是sql server
你可以这样写
select top 20 * from (select top 40 * from tablename order by id) order by id asc
其实方法很多啊
如果是变量你可以用
动态sql
例如
俄execute("select top "+convert(varchar(2),@kkk-@kk)+" * from (select top "+convert(numeric(2,0),@kkk)"+" iid as iiid from tablename order by iid) b order by b.iiid asc");
类似 Select * from (select * from Table) 这样的查询语句
支不只支持,与你使用的连接引擎有关!
如果你是用的Delphi的BDE的话就不支持!
如果是ODBC的话就可以!!!试试用ODBC设置DNS!
select top 20 * from (select top 40 * from tablename order by id)as t1 order by id asc
其他的不一定有啊