数据库是这样的:
有一张表:bbs_forums 其中有字段:fid(板块id),name(板块名),rootid(跟目录),depth(菜单级别),child(子菜单个数) 现在我想通过一个下拉框将其数据格式化的输出!
就如: >a
>a1
>a2
>b
>b1
>b2
>c
>c1
>c2
请问sql语句该如何写????
谢谢!
有一张表:bbs_forums 其中有字段:fid(板块id),name(板块名),rootid(跟目录),depth(菜单级别),child(子菜单个数) 现在我想通过一个下拉框将其数据格式化的输出!
就如: >a
>a1
>a2
>b
>b1
>b2
>c
>c1
>c2
请问sql语句该如何写????
谢谢!
解决方案 »
- 一个SQL联合查询的问题
- 为什么要重新启动服务(tomcat)才可以访问到远程mysql最新数据?
- mysql utf8乱码问题 急!!!
- 求教一条SQL语句
- 我的数据表都是以这三种格式存在的:xxx.ISD,xxx.frm,xxx.ISM,如何恢复这种数据库?
- 查询如何显示在MSFlexGrid网格控件中的问题。救急!
- 我在安装mysql时发现的问题
- MySQL如何连接Access数据库。。。
- 关于制定数字类型长度的问题,好像输入的数据不受制定长度限制。
- mysql拿来做数据仓库和数据挖掘是否合适?它有什么对应的ETL工具吗?
- 关于MySQL中char(4)汉字输入的问题
- 一条sql我问两次,为的是求人解决
from bbs_forums
where rootid is null
union all
select concat(' >', name),fid,rootid,fid as skey
from bbs_forums
where rootid is not null
order by 3,4
(
select concat('>', name),fid,fid as rootid,0 as skey
from bbs_forums
where rootid is null
union all
select concat(' >', name),fid,rootid,fid as skey
from bbs_forums
where rootid is not null
)
order by 3,4