菜鸟求一SQL语句,显示同一表内三级栏目列表
表结构如图
cid int 栏目ID
fatherid int 父栏目ID
childid text 子栏目ID
childids text 所有下级栏目ID
deeppath int 栏目层次
name varchar 栏目名称
求一SQL语句,显示同一表内三级栏目列表,效果如下:
一级栏目-1 二级栏目-1 三级栏目-1
一级栏目-1 二级栏目-1 三级栏目-2
一级栏目-2 二级栏目-2 三级栏目-3
一级栏目-2 二级栏目-2 三级栏目-4
一级栏目-2 二级栏目-3 三级栏目-5
没看懂
还是我发错版块了??? ^_^
树形结构,图的问题,学习中
SQL code:
declare @t table(id int,fatherid int,name varchar(10))
insert @t select 9,0,'一级栏目-1'
insert @t select 10,9,'二级栏目-1'
insert @t select 11,10,'三级栏目-1'
insert @t select 12,10,'三级栏目-2'
insert @t select 13,0,'一级栏目-2'
insert @t select 14,13,'二级栏目-2'
insert @t select 15,14,'三级栏目-3'
insert @t select 16,14,'三级栏目-4'
insert @t select 17,13,'二级栏目-3'
select a.name,b.name,c.name
from @t a
right join @t b on a.id = b.fatherid
left join @t c on b.id = c.fatherid
where a.fatherid = 0
name name nam
相关问答:
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
org.apache.jas ......
表
id bh
1 10
2 11
3 12
4 15
5 16
6 22
7 25
8 26
9 27
10 28
将bh按连续分段出来返回字符串:
10~12,15~16,22,25~28
SQL code:
declare @t tabl ......
sqlserver2005 建立的数据库,与手持pda传输数据,最近突然出现无法传递数据的问题,pda端提示的错误时outofmemoryexception,但是pda上面的容量没有问题,
sqlserver的日子上的错误如下:
日期 2010-1-25 14:45: ......
有两个或以上的远程数据库,如何用ASP检测连接速度并连接最快的MSSQL数据库?
有这样的ASP函数吗?我GOOGLE了一下,找不到。
PHP+MYSQL下有这种例子:
PHP code:
Example:
$wgDBservers = array(
......
tab1 字段:billdate,goodsid,incount,inmoney,outcount,outmoney,endprice,endcount,endamt
tab2 字段:goodsid,goodskind(商品类型)
tab3 字段:goodskind(商品类型),kindname
结果:
得到商品类型在一段时间 ......