update语句【NC】

  

 1 package nc.bs.ta.attmonth.services;
 2 
 3 import nc.bs.dao.BaseDAO;
 4 import nc.bs.dao.DAOException;
 5 
 6 public class AttMonthServicesImpl {
 7 
 8 private BaseDAO dao = null;
 9 
10 private BaseDAO getDao() {
11 if (dao == null) {
12 dao = new BaseDAO();
13 }
14 return dao;
15 }
16 
17 public void execlUpdate(String pk_attmonth) {
18 StringBuffer buf = new StringBuffer();
19 buf.append(" DELETE from hrss_attmonth_monthstat WHERE pk_attmonth='"
20 + pk_attmonth + "' and pk_psndoc ");
21 buf.append(" IN ( SELECT pk_psndoc FROM hrss_attmonth_monthstat where pk_attmonth = '"
22 + pk_attmonth
23 + "' GROUP BY pk_psndoc HAVING COUNT(pk_psndoc) > 1) ");
24 buf.append(" AND ROWID NOT IN (SELECT MIN(ROWID) FROM hrss_attmonth_monthstat where pk_attmonth = '"
25 + pk_attmonth + "' GROUP BY pk_psndoc HAVING COUNT(*) > 1) ");
26 try {
27 getDao().executeUpdate(buf.toString());
28 } catch (DAOException e) {
29 e.printStackTrace();
30 }
31 }
32 }

 

你可能感兴趣的:(update语句【NC】)