1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- /****** Script for SelectTopNRows command from SSMS ******/
- /*
- SELECT [id]
- ,[from]
- ,[checkcontent]
- ,[clientqq]
- ,[contact]
- ,[clerk]
- ,[useqq]
- ,[date]
- ,[time]
- ,[question]
- ,[solution]
- ,[result]
- ,[autoid]
- FROM [Internal].[dbo].[clientservice] where clerk = '黄飞' and [date] > '2015-01-01' and [date] < '2016-01-01' */
- -- select * from [clientservice] where clerk = '黄飞' and [date] > '2015-01-01' and [date] < '2016-01-01'
-
- --1
- select
- count(*) as '远程总数',
- count(case result when '满意' then 'ok'end) ,
- count(case result when '非常满意' then 'ok'end) ,
- count(case result when '不满意' then 'ok'end) ,
- count(case result when '一般' then 'ok'end) ,
- count(case result when 'ok' then 'ok'end) --,clerk
- from [clientservice]
- where [date] > '2015-01-01' and [date] < '2016-01-01'
- group by clerk order by clerk
- --2
- select
- count(*) as '远程总数',
- count(case result when '满意' then 'ok'end) ,
- count(case result when '非常满意' then 'ok'end) ,
- count(case result when '不满意' then 'ok'end) ,
- count(case result when '一般' then 'ok'end) ,
- count(case result when 'ok' then 'ok'end)
- from [clientservice]
- where clerk = '黄飞'
- and [date] > '2015-01-01' and [date] < '2016-01-01'
- select count(result) from [clientservice] where clerk = '黄飞' and [date] > '2015-01-01' and [date] < '2016-01-01' and result = '不满意'
|