码迷,mamicode.com
首页 > 其他好文 > 详细

update语句【NC】

时间:2016-01-30 22:30:18      阅读:203      评论:0      收藏:0      [点我收藏+]

标签:

  

 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】

标签:

原文地址:http://www.cnblogs.com/zzzzw/p/5171512.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!