2011年3月13日
摘要: 提问:id mc parent1 机械 -12 化工机械 13 反应器 2相得到 id mc parent rj1 机械 -1 机械2 化工机械 1 机械\化工机械3 反应器 2 机械\化工机械反应器关键是树结构的层次不确定,不知道有多少级解答:use InsideTSQL2008;go if OBJECT_ID('dbo.Test_tab') is not null drop table dbo.Test_tab;create table dbo.Test_tab( id int primary key, mc nvarchar(100) not null, parentid 阅读全文
posted @ 2011-03-13 21:57 冷酒少 阅读(597) 评论(0) 推荐(2) 编辑
摘要: 一.控制多联接的物理计算顺序在编写查询语句时,经常会多次联接查询多个表。在没有外联接的多联接查询中,连接查询的先后顺序对最终的结果是无影响的,查询优化器知道这一点,所以在最终的执行计划中,优化器访问表的顺序可能跟查询语句中指定的联接顺序不一样。例如,对于以下这样的一个多联接的查询:use Northwind;GOselect c.contactname,o.orderid,p.ProductName,s.ContactName from dbo.Customers c inner join dbo.Orders o on c.CustomerID=o.CustomerIDinner join 阅读全文
posted @ 2011-03-13 12:03 冷酒少 阅读(2326) 评论(6) 推荐(2) 编辑