首页 > 代码库 > 1.sql统计语句
1.sql统计语句
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统计语句