首页 > 数据库技术 > 详细

1.sql统计语句

时间:2016-09-17 17:57:23      阅读:211      评论:0      收藏:0      [点我收藏+]

select exam_item_code, exam_item, EXAMDATE, count(distinct patient_id)
from (select t2.exam_item_code,
t2.exam_item,
to_char(t1.exam_date_time, ‘yyyy-mm‘) as EXAMDATE,
t1.patient_id
from exam.exam_master t1, exam.exam_items t2
where t1.exam_no = t2.exam_no
and exam_date_time >=
to_date(‘2014-07-01 00:00:00‘, ‘yyyy-mm-dd hh24:mi:ss‘)
and exam_date_time <=
to_date(‘2015-06-30 23:59:59‘, ‘yyyy-mm-dd hh24:mi:ss‘)
and exam_class = ‘CT‘
and performed_by = ‘2401‘
and t2.exam_item_code in
(‘210300110‘, ‘210300111‘, ‘210300109‘, ‘210300108‘,
‘210300036‘, ‘210300037‘, ‘210300134‘, ‘210300125‘,
‘210300069‘, ‘210300070‘, ‘210300071‘, ‘210300080‘,
‘210300115‘)
--and t2.exam_item_code in (‘210300134‘)
)
group by exam_item_code, exam_item, EXAMDATE
order by exam_item_code, exam_item, EXAMDATE desc

1.sql统计语句

原文:http://www.cnblogs.com/yinsheng/p/5879239.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!