回答編集履歴
1
追記
answer
CHANGED
|
@@ -7,4 +7,17 @@
|
|
|
7
7
|
(3,11,'1,5,10,11');
|
|
8
8
|
|
|
9
9
|
select * from tbl where not find_in_set(goods_id,excluded_goods_id)
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
# 追記
|
|
13
|
+
json型をつかっていいならこの方が楽かもしれません
|
|
14
|
+
|
|
15
|
+
```SQL
|
|
16
|
+
create table tbl(id int primary key,goods_id int,excluded_goods_id json);
|
|
17
|
+
insert into tbl values
|
|
18
|
+
(1,1,'[1,5,10,11]'),
|
|
19
|
+
(2,2,'[1,5,10,11]'),
|
|
20
|
+
(3,11,'[1,5,10,11]');
|
|
21
|
+
|
|
22
|
+
select * from tbl where not JSON_CONTAINS(excluded_goods_id,goods_id)
|
|
10
23
|
```
|