delete from table where exists (select 1 from table where tr_date=table.tr_date and tr_num=table.tr_num and tr_id=table.tr_id and tr_note=table.tr_note group by tr_date,tr_num,tr_id,tr_note having count(*)>1)
and id not in (select max(id) from table group by tr_date,tr_num,tr_id,tr_note having count(*)>1)
delete from gl_projtr where id not in(select min(id) from gl_projtr group by tr_note)
如果是sql server 2005的话可以这样写
delete from gl_projtr
where id in
(
select id,row_number over(partition by tr_date,tr_num,tr_id,tr_note) as rn
from gl_projtr
where rn>1
)