sql语句中distinct的写法问题
sql语句如下:
select
count(a.mtn_id),
a.mgr_branch_no,i.branch_name,
a.mtn_biz_no,e.name,j.name,b.proc_date,
g.o_sales_code,a.oclk_clerk_code
from mtn_gen_info a,mtn_alt_cntr b,
mtn_holder c,
unev_customer d,
unev_psn_customer e,
std_contract g,
insur_appl_regist h,
branch i,
psn_cntr_holder j
where a.mtn_id = b.mtn_id
and a.mtn_id = c.mtn_id
and c.phr_cust_no = d.cust_no
and d.cust_id = e.cust_id
and b.mtn_item_code = '06'
and g.cntr_stat = 'K'
and a.mtn_biz_no = g.cntr_no
and g.appl_no = h.appl_no
and g.cntr_id = j.cntr_id
and a.mgr_branch_no ="330200"
group by
a.mgr_branch_no,a.oclk_clerk_code,i.branch_name,
a.mtn_biz_no,e.name,j.name,b.proc_date,
g.o_sales_code
having count(a.mtn_id) > 10
现在查出的数据有全部字段重复的数据,现在想去掉重复的,有count,加distinct时出错,该怎么写
[解决办法]
please try to add "UNIQUE" after select.