Goodspeed

导航

2004年10月15日 #

SQL Server 2005中的递归实现

摘要: SELECT * INTO t --载入测试数据FROM( SELECT 1 AS ID,'food' AS Product,0 AS ParentID UNION ALL SELECT 2,'sport',0 UNION ALL SELECT 3,'drink',1 UNION ALL SELECT 4,'ball',2 UNION ALL SELECT 5,'f... 阅读全文

posted @ 2004-10-15 17:13 Goodspeed 阅读(2228) 评论(2) 推荐(1) 编辑

SQL Server 2005中的PIVOT和UNPIVOT的例子

摘要: DECLARE@tTABLE(studentvarchar(50),classvarchar(50),gradeint)INSERTINTO@tSELECT'孙小美','数学',10UNIONALLSELECT'孙小美','语文',20UNIONALLSELECT'孙小美','英语',30UNIONALLSELECT'阿土伯','数学',40UNIONALLSELECT'阿土伯','语文',50UNIONALLSELECT'阿土 阅读全文

posted @ 2004-10-15 14:27 Goodspeed 阅读(1830) 评论(0) 推荐(0) 编辑