select floor(id/2) xh, id , name from t1
;select a.id , a.name
from t1 a
inner join t1 b on mod( b.id,2)=1
and b.id = a.id +1
where mod( a.id,2)=0可以用rownum,这里就不写了
;select a.id , a.name
from t1 a
inner join t1 b on mod( b.id,2)=1
and b.id = a.id +1
where mod( a.id,2)=0可以用rownum,这里就不写了
解决方案 »
- 路过的大虾,请假下!
- 如何解决ORA-01799左关联中不允许使用子查询!~
- 关于记录表的问题
- 在CSDN发帖标题一定要长,嘿嘿!本人现在想往数据库方面发展,成为这方面的大牛都要什么基础,欢迎拍砖,呼呼?
- 请问decode内是滞可以写SQL语句。谢谢
- 怎样选择字段中只有数字、逗号和分号的记录,字段类型为clob
- ORACLE分不清哪个是系统表哪个是用户表,应该如何解决这个问题
- 南北软件面试题目。。。。。。。。。。谁能做出来?
- 请问各位大虾:正版全套oracle8i多少张光盘?
- 关于关闭oracle外键约束的sql语句问题
- pl/sql developer 语句执行问题
- 有没有判断一条记录或一个数据存在与否的函数?
第一,我字段里的ID 是我随便写的,也可能是A、B、C、D、E不能当查询条件用。而且查询出来的新序号是0,1,1,2,2 不是我想要的0,0,1,1,2第二、用第二条语句得到的结果是
钱 孙
立 周
而“赵” 不在查询结果之内。
;select a.id , a.name ,b.id , b.name
from (select rownum r,t1.* from t1) a
left outer join (select rownum r,t1.* from t1) b on mod( b.r,2)=0
and b.r = a.r +1
where mod( a.r,2)=1
sqlserver里的 select top 1 * from table 在oracle里怎么写??