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

用sql語句實現

問題如下:
產品結構表
主 元
A B
B C
C D

實現結果如下A->B->C->D

用with递归

SELECT 主 from AA
start with 主='A'
 connect by prior 元 = 主

SQL code:

Connected to Oracle Database 10g Enterprise Edition Release 10.2.0.1.0
Connected as


SQL>
SQL> with table1 as
2 (
3 select 'A' parent1,'B' child1 from dual
4 union all
5 select 'B' ,'C' from dual
6 union all
7 select 'C','D' from dual
8 union all
9 select 'K','E' from dual
10 )
11 select concat('A->', replace(wm_concat(child1), ',', '->'))
12 from table1
13 start with parent1 = 'A'
14 connect by prior child1 = parent1
15 /

CONCAT('A->',REPLACE(WM_CONCAT
--------------------------------------------------------------------------------
A->B->C->D

SQL>



SQL code:
10:01:52 tina@PRACTICE> with tb as (
10:01:54 2 select 'A' 主,'B' 元 from dual
10:01:54 3 union all
10:01:54 4 select 'B','C' from dual
10:01:54 5 union all
10:01:54 6 select 'C','D' from dual
10:01:54 7 )
10:01:54 8 select 'A->'||replace(wm_concat(


相关问答:

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

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

SQL如何优化问题 - MS-SQL Server / 疑难问题

今天做了一个存储过程   环境是SQL2000数据库  
大致如下
建立临时表
定义员工游标
        循环员工(属于1个公司)  
        ......

求一sql语句 - MS-SQL Server / 疑难问题

现在有两张表:文章主表A(articleId,articleTitle),文章评论表B(commentId,articleId,commentTitle)
现在我想实现这样的功能:列出文章列表,其中每篇文章标题下面列出此文章的前2个文章评论,请问sql语句怎么写啊 ......

sql - MS-SQL Server / 疑难问题

sql的软件在哪里可以下啊!在网上找了蛮多都用不了啊

随便搞一D版吧,

迅雷第一个就可以用
2000,2005都这样

http://119.147.41.16/down?cid=0698C2D64D7D637D90A6D2482298E6717D4F15CD&t=2&fmt=-1 ......

关于SQL Server Mobile Edition - .NET技术 / ASP.NET

关于SQL Server Mobile Edition
用Microsoft SQL Server2005 Management Studio Express9.00.3042.00创建SQLCE数据库sqlmobile.sdf
在mobile系统终端上用SQL Server Mobile Edition3.0能查看sqlmobile.sdf里表数据 ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号