查询表中重复数据的有多少


select sub_box_no ,COUNT(* ) from
(
SELECT * FROM Box_Sub_History WHERE (transaction_date between '2012/9/14' and '2012/9/15')
AND ( qty_flag = 1 ) AND (previous_branch in (1)) AND (box_mother_type IN ('K '))
and box_mother_no =309
and tran_code in (128 )
) a
group by a.box_mother_no ,a.sub_box_no
having COUNT(* ) >1

 

posted @ 2012-10-16 18:08  withoutaword  阅读(162)  评论(0编辑  收藏  举报