C#技术百科
问问你的心你有没有信心 做事情要专一坚定,执着

select Column_ID,Column_Name,Parent_ID,(select Column_Name from [Sort] where Column_ID=a.Parent_ID) Parent_Name,
(select Parent_ID from [Sort] where Column_ID=a.Parent_ID) Fathers_ID,
(select Column_Name from [Sort] where Column_ID=(select Parent_ID from [Sort] where Column_ID=a.Parent_ID)) Father_Name
from [sort] a where Column_Depth=3 order by father_Name desc,Parent_Name desc,Column_Name desc

比较牛B的sql语句,可以嵌套查询,还可以根据临时字段名排序

posted on 2008-08-06 14:47  王德田  阅读(658)  评论(0编辑  收藏  举报