谁可以给个sqlserver2005两张表之间的递归查询,我看网上都是一张表两个字段之间递归查询.

2024-12-31 09:09:49
推荐回答(2个)
回答1:

with
district as
(
select * from SECFUNMODULE where MENUID='030'
union all
select a.* from SECFUNMODULE a, district b
where a.PMENUID = b.MENUID
),
district1 as
(
select a.* from district a where a.MENUID in (select PMENUID from district)
)
select * from district1 order by MENUID

with当然可以实现.
请参照sqlserver2005 的递归查询
http://blog.csdn.net/chenghaibing2008/article/details/8501322

回答2:

实现很容易,
什么问题可以涉及到两张表递归呢? 具体说说