读书人

sql心得

发布时间: 2012-07-22 19:31:17 作者: rapoo

sql经验

1.树

select 2009 + (level - 1) from dual connect by level <= 12

?

2.递归

找小弟
?select? *
from?? t_sys_org?? start?? with??? orgid in (select? orgid from?? t_sys_org?? where?? name ='广州技术开发服务中心')
? connect?? by?? prior?? orgid=orgpid


找大哥
select? *
from?? t_sys_org?? start?? with?? name ='广州技术开发服务中心'
? connect?? by?? prior?? orgpid=orgid? and orgpid = '9999999999999999999'

?

?

读书人网 >SQL Server

热点推荐