易截截图软件、单文件、免安装、纯绿色、仅160KB

SQL查询问题(oracle) - Oracle / 开发

如下2张表:
table1:
node_id
parent_id
root_id
value

table2:
node_id
status

表1存储了一棵树,表2存储了节点状态,问题如下:

如何用SQL语句获得状态status为1的节点的所有子节点以及其下子树中所有节点的value?

求解。由于客观因素只能用sql实现,不然就递归了。。。多谢大家

select a.node_id,a.value
from table1 a,table2 b
where a.node_id=b.node_id
start with b.status=1
connect by prior a.node_id=a.parent_id

UP,这个需要用到 start...wiht connect by 语法,层次查询。
引用
select a.node_id,a.value
from table1 a,table2 b
where a.node_id=b.node_id
start with b.status=1
connect by prior a.node_id=a.parent_id


引用
select a.node_id,a.value
from table1 a,table2 b
where a.node_id=b.node_id
start with b.status=1
connect by prior a.node_id=a.parent_id


多谢回复!不过报 sql command not properly ended 错误,试了很多顺序还是不行,望解答,谢谢了

SQL code:

create table tb(id int,pid int);
insert into tb select 1,0 from dual;
insert into tb select 2,0 from dual;
insert into tb select 3,1 from dual;
insert into tb select 4,1 from dual;
insert into tb select 5,3 from dual;
create table tc(id int,statu


相关问答:

csv文件转换成sql导入到数据库,没有数据为何?

执行的顺序:
1)文件浏览框(选择文件使用)
选择好文件后
点击一个导入按钮的时候 ,把上面上传框里的csv文件以一个ID为文件名,上传到**/**文件夹下
2)读取这个文件夹下的csv的文件,转换成sql
3 ......

jsp链接sql2000的疑问?



type Exception report


message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

org.apache.jas ......

关于SQLSERVER底层问题 - MS-SQL Server / 疑难问题

请问一下,外网两台SQLSERVER实例数据传输,有没有采用数据压缩和加密。压缩比是多少,加密是什么加密算法?相关文档哪里可以找到?谢谢


我也想知道!关注此贴!

关注~~

数据库大牛都哪去了啊?
......

Oracle 数据导出问题 - Oracle / 高级技术

exp user/password@dbname file=c:\table.dmp tables=jbitaku,jbitakum grants=y
然後按回車鍵 說明:  user/password@dbname  分別表示用戶名,密碼和服務名 f ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号