QueryRunner qr = new QueryRunner(C3P0Util.getDataSource());
qr.update("DELETE FROM course_access " +
"WHERE user_id = ? " +
"AND course_id NOT IN (?)", user_id, courseIdList);
String user_id = "2"
String courseIdList = "101,102,104,105,106,108,109"
但结果不正确
只有结果相同
DELETE FROM course_access WHERE user_id=2 AND course_id NOT IN (101)
表结构如下所示
id course_id user_id
1 101 1
2 102 1
3 105 1
4 104 1
5 106 1
6 108 1
11 110 1
12 101 2
26 101 8
27 102 8
28 105 8
29 104 8
30 106 8
31 108 8
32 110 8
33 113 8
34 115 1
35 107 1
36 115 8
37 109 8
38 109 1
39 107 8
40 116 8
41 116 1
98 102 2
99 103 2
100 104 2
101 105 2
102 106 2
103 107 2
104 108 2
105 109 2