摘要: 比如表中有两列数据 :id name1 a1 b1 c2 d2 e变成如下格式:id name1 a,b,c2 d,e数据:if object_id(#表)is not null drop table #表select did,name, from #表 order by diddrop table... 阅读全文
posted @ 2014-08-28 16:49 起航Fly 阅读(14740) 评论(1) 推荐(0) 编辑
摘要: 通过case when 进行自定义排序select * from (select a.c#,cname,case when score>=85 then '100-85' when score=70 then '85-70' ... 阅读全文
posted @ 2014-08-26 10:31 起航Fly 阅读(463) 评论(0) 推荐(0) 编辑
摘要: 对明细中的同一主键ID相关数据进行合并1.主表的【项目】+明细表的【附加项目】2.明细表的金额数据源if object_id('tempdb..#主表') is not null drop table tempdb..#主表if object_id('tempdb..#细表') is not nul... 阅读全文
posted @ 2014-08-25 16:47 起航Fly 阅读(877) 评论(0) 推荐(0) 编辑