use cdss_prod
--
--select top 5 datedifF(second, dt_created_by, dt_updated_by),* from t_queue where cd_case_type=1 and nm_queue_type=1 order by 2 desc
--select top 50 datedifF(second, dt_created_by, dt_updated_by),* from t_queue where cd_case_type=2 and nm_queue_type=1 order by 2 desc
--select top 5 * from t_alert where cd_source_app='39211' order by 1 desc
--
--retrieve speed of QueueProcessing
DECLARE @startDt datetime, @endDT datetime;
SET @startDT = DATEADD(minute,+60, '2015-09-01 00:00') --'2015-05-14 15:45:35.047'-- '2015-05-14 15:20:00.000'
SET @endDT = DATEADD(minute,-0, '2015-12-31 23:59'); --'2015-05-14 15:55:35.047'-- '2015-05-14 15:40:00.000'
select @startDT,@endDT,timeDiff,CaseType,QueueType,count(id_queue)
from
(
SELECT (CASE
WHEN DATEPART(hour, dt_created_by) = '0' THEN '00 - 01'
WHEN DATEPART(hour, dt_created_by) = '1' THEN '01 - 02'
WHEN DATEPART(hour, dt_created_by) = '2' THEN '02 - 03'
WHEN DATEPART(hour, dt_created_by) = '3' THEN '03 - 04'
WHEN DATEPART(hour, dt_created_by) = '4' THEN '04 - 05'
WHEN DATEPART(hour, dt_created_by) = '5' THEN '05 - 06'
WHEN DATEPART(hour, dt_created_by) = '6' THEN '06 - 07'
WHEN DATEPART(hour, dt_created_by) = '7' THEN '07 - 08'
WHEN DATEPART(hour, dt_created_by) = '8' THEN '08 - 09'
WHEN DATEPART(hour, dt_created_by) = '9' THEN '09 - 10'
WHEN DATEPART(hour, dt_created_by) = '10' THEN '10 - 11'
WHEN DATEPART(hour, dt_created_by) = '11' THEN '11 - 12'
WHEN DATEPART(hour, dt_created_by) = '12' THEN '12 - 13'
WHEN DATEPART(hour, dt_created_by) = '13' THEN '13 - 14'
WHEN DATEPART(hour, dt_created_by) = '14' THEN '14 - 15'
WHEN DATEPART(hour, dt_created_by) = '15' THEN '15 - 16'
WHEN DATEPART(hour, dt_created_by) = '16' THEN '16 - 17'
WHEN DATEPART(hour, dt_created_by) = '17' THEN '17 - 18'
WHEN DATEPART(hour, dt_created_by) = '18' THEN '18 - 19'
WHEN DATEPART(hour, dt_created_by) = '19' THEN '19 - 20'
WHEN DATEPART(hour, dt_created_by) = '20' THEN '20 - 21'
WHEN DATEPART(hour, dt_created_by) = '21' THEN '21 - 22'
WHEN DATEPART(hour, dt_created_by) = '22' THEN '22 - 23'
ELSE '23 - 00'
END
) AS timeDiff
, id_queue, (CASE nm_queue_type WHEN 1 THEN 'Med Queue' ELSE 'Lab Queue' END) AS QueueType
, (CASE cd_case_type WHEN 1 THEN 'eIMR' WHEN 2 THEN 'eRX' ELSE 'DRx' END) AS CaseType
FROM t_queue WHERE nm_del_flag=1
AND NM_FLAG_PROCESS>0
AND (dt_created_by between @startDT AND @endDT) AND nm_queue_type=1 and cd_case_type in (1)
)
GROUP BY timeDiff,CaseType,QueueType ORDER BY queuetype DESC, casetype desc, timediff DESC
select count(*) as totalERxCount from t_queue with (nolock)
where (dt_created_by between @startDT and @endDT) and nm_queue_type=1 and cd_case_type=1
答案 0 :(得分:0)
您需要在FROM子句
中指定别名case android.R.id.home:
if (drawerLayout.isDrawerOpen(GravityCompat.END)) {
drawerLayout.closeDrawer(GravityCompat.END);
} else {
drawerLayout.openDrawer(GravityCompat.END);
}
答案 1 :(得分:0)
使用表别名
尝试下面的一个 select @startDT,@endDT,timeDiff,CaseType,QueueType,count(id_queue)
from
(
SELECT (CASE
WHEN DATEPART(hour, dt_created_by) = '0' THEN '00 - 01'
WHEN DATEPART(hour, dt_created_by) = '1' THEN '01 - 02'
WHEN DATEPART(hour, dt_created_by) = '2' THEN '02 - 03'
WHEN DATEPART(hour, dt_created_by) = '3' THEN '03 - 04'
WHEN DATEPART(hour, dt_created_by) = '4' THEN '04 - 05'
WHEN DATEPART(hour, dt_created_by) = '5' THEN '05 - 06'
WHEN DATEPART(hour, dt_created_by) = '6' THEN '06 - 07'
WHEN DATEPART(hour, dt_created_by) = '7' THEN '07 - 08'
WHEN DATEPART(hour, dt_created_by) = '8' THEN '08 - 09'
WHEN DATEPART(hour, dt_created_by) = '9' THEN '09 - 10'
WHEN DATEPART(hour, dt_created_by) = '10' THEN '10 - 11'
WHEN DATEPART(hour, dt_created_by) = '11' THEN '11 - 12'
WHEN DATEPART(hour, dt_created_by) = '12' THEN '12 - 13'
WHEN DATEPART(hour, dt_created_by) = '13' THEN '13 - 14'
WHEN DATEPART(hour, dt_created_by) = '14' THEN '14 - 15'
WHEN DATEPART(hour, dt_created_by) = '15' THEN '15 - 16'
WHEN DATEPART(hour, dt_created_by) = '16' THEN '16 - 17'
WHEN DATEPART(hour, dt_created_by) = '17' THEN '17 - 18'
WHEN DATEPART(hour, dt_created_by) = '18' THEN '18 - 19'
WHEN DATEPART(hour, dt_created_by) = '19' THEN '19 - 20'
WHEN DATEPART(hour, dt_created_by) = '20' THEN '20 - 21'
WHEN DATEPART(hour, dt_created_by) = '21' THEN '21 - 22'
WHEN DATEPART(hour, dt_created_by) = '22' THEN '22 - 23'
ELSE '23 - 00'
END
) AS timeDiff
, id_queue, (CASE nm_queue_type WHEN 1 THEN 'Med Queue' ELSE 'Lab Queue' END) AS QueueType
, (CASE cd_case_type WHEN 1 THEN 'eIMR' WHEN 2 THEN 'eRX' ELSE 'DRx' END) AS CaseType
FROM t_queue WHERE nm_del_flag=1
AND NM_FLAG_PROCESS>0
AND (dt_created_by between @startDT AND @endDT) AND nm_queue_type=1 and cd_case_type in (1)
) AliaseTable
GROUP BY timeDiff,CaseType,QueueType ORDER BY queuetype DESC, casetype desc, timediff DESC