select *
from (
select row_number()over(order by t.hid) 索引,*
from (select top 10 * from hotel)t
)tt
where 索引>5
我想把上面的查询结果再和另外一张表做一次连接应该怎么做?
解决方案 »
- 急求一解,关于加减的问题
- 求 sql2000 恢复和备份 sql代码,和例子
- 求方法--记录排序问题
- 两个SQL语句,怎么会不一样呢?
- 存储过程问题??
- 一个公司要考验我的问题,各位大哥帮忙呀(等待中)
- 如何用sql语句判断两条记录是否同时存在
- 将access数据库转换成sql后用sqloledb重新建立连接后提示:Microsoft OLE DB Provider for SQL Server 错误 '80004005' 用户 'sa' 登录失
- 怎样把我数据库中的所有的数据一次性从简体该为繁体?(数据库Sql server 7)
- 请问,实际场合下什么时候使用交叉连接cross join,在select语句中交叉连接经常与什么clause配合使用
- 版主,各位高手,还是字符提取问题!!请求帮忙!!!
- 求高手解决sqlserver 提取字符问题!!!!
--如果是SQL SERVER 2000的话--嵌套一下select * from
(
select *
from (
select row_number()over(order by t.hid) 索引,*
from (select top 10 * from hotel)t
)tt
where 索引>5
) a left join 另外的表 b on a.id=b.id--如果是SQL SERVER 2005+的话--用with 表达式;with a as
(
select *
from (
select row_number()over(order by t.hid) 索引,*
from (select top 10 * from hotel)t
)tt
where 索引>5
)
select * from a left join 另外的表 b on a.id=b.id
from (
select row_number()over(order by t.hid) 索引,*
from (select top 10 * from hotel)t
) tt left join 另外一张表 b on tt.字段=b.字段
where tt.索引>5