declare @t table(name varchar(),type int)
insert into @t
select 'a',
union all select 'b',
union all select 'fb',
union all select 'fbf',
union all select 'fdfs', if object_id('test1') is not null
drop table test1
create table test1(
name varchar(),
type int)
insert into test1
select 'a',
union all select 'b',
union all select 'fb',
union all select 'fbf',
union all select 'fdfs', select * from test1 create function ss()
returns varchar()
as
begin
declare @sql varchar()
set @sql=''
select @sql=@sql+','+ name from test1
set @sql=stuff(@sql,,,' ')
return @sql
end select dbo.ss(),count_0=(select count() from test1 where type=),
count_1=(select count() from test1 where type=),
count_2=(select count() from test1 where type=)
/*
我想要的结果是这样的
name count_0 count_1 count_2
a,b,fb,fbf,fdfs 2 2 1 */

最新文章

  1. BZOJ 3275: Number
  2. 【求助】WPF 在XP下 有的Textbox光标会消失
  3. SpringMVC问题- MultipartConfig 配置问题以及解决方式
  4. Eclipse在线集成maven M2eclipse插件
  5. Emit学习(4) - Dapper解析之数据对象映射(二)
  6. java多态例子
  7. HDU3709 Balanced Number (数位dp)
  8. php substr,iconv_substr,mb_substr
  9. 《应用Yii1.1和PHP5进行敏捷Web开发》学习笔记(转)
  10. javascript事件小结(事件处理程序方式)--javascript高级程序设计笔记
  11. 关于在打包Jar文件时遇到的资源路径问题(一)
  12. Orchard学习计划
  13. 《MySQL必知必会》[01] 基本查询
  14. Linux自定义分隔符IFS引发的文本处理问题
  15. 微信小程序测试方法总结
  16. C语言的#if #ifdef #ifndef
  17. python并发编程基础之守护进程、队列、锁
  18. python目标定位(借鉴csdn上大神)
  19. JS-详解算数运算符"+"
  20. jQuery WeUI V0.4.2 发布

热门文章

  1. python pydoc
  2. Android视录视频示例
  3. Apache,PHP,MySQL,PMA手动配置的注意事项
  4. Python文件处理之文件写入方式与写缓存(三)
  5. Redis持久化机制和恢复机制
  6. shopex用户登陆错误提示在nginx下乱码问题
  7. [Hibernate] - Study test project
  8. Servlet Filter 2
  9. Redis报错:WRONGTYPE Operation against a key holding the wrong kind of value 解决处理
  10. windows mobile仿真器内存调整