摘要: 独立子查询 独立标量子查询 相关子查询 not in () 的null值处理. --返回由拥有订单数目最多的客户下过的所有订单. 注意, 多个客户可能下过的订单数目是一样的--因此用到了with ties子句--select o.custid, o.orderid, o.orderdate, o.empid from Sales.Orders o wh... 阅读全文
posted @ 2012-04-09 16:30 MyCoolDog 阅读(2059) 评论(0) 推荐(0)
摘要: declare @t table(n int)declare @i int=1while(@i<1000)begin insert into @t select @i set @i=@i+1end--select * from @t--1. copy all employees five times.--select e.empid,e.firstname,e.lastname, t.... 阅读全文
posted @ 2012-04-09 11:15 MyCoolDog 阅读(599) 评论(0) 推荐(0)