私は在庫 chara_idと呼ばれるこのテーブルを持っています
、item_idとitem_levelは1つの一意の制約です
+--------------+----------+---------+------------+----------+
| inventory_id | chara_id | item_id | item_level | item_qty |
+--------------+----------+---------+------------+----------+
| 35 | 1 | 2 | 0 | 3 |
| 37 | 1 | 14 | 0 | 1 |
| 46 | 4 | 4 | 0 | 1 |
| 49 | 1 | 3 | 0 | 1 |
| 66 | 16 | 6 | 0 | 1 |
| 67 | 16 | 1 | 0 | 1 |
| 75 | 17 | 3 | 0 | 1 |
| 78 | 15 | 2 | 0 | 1 |
| 86 | 12 | 3 | 0 | 2 |
| 88 | 12 | 1 | 0 | 1 |
+--------------+----------+---------+------------+----------+
そして、機器と呼ばれるこの2番目のテーブルがあります
+----------+----------+-----------+-------------+----------+---------+--------------+----------------+-------------+------------+
| equip_id | chara_id | weapon_id | headgear_id | armor_id | ring_id | weapon_level | headgear_level | armor_level | ring_level |
+----------+----------+-----------+-------------+----------+---------+--------------+----------------+-------------+------------+
| 1 | 1 | 2 | 16 | 18 | 17 | 0 | 0 | 0 | 0 |
| 2 | 2 | 2 | 5 | 6 | 0 | 0 | 0 | 0 | 0 |
| 3 | 3 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
| 4 | 4 | 2 | 5 | 6 | 8 | 0 | 0 | 0 | 0 |
| 5 | 5 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
| 6 | 6 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
| 7 | 7 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
| 8 | 8 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
| 9 | 9 | 4 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
| 10 | 10 | 12 | 5 | 18 | 0 | 0 | 0 | 0 | 0 |
+----------+----------+-----------+-------------+----------+---------+--------------+----------------+-------------+------------+
私が欲しいのは
、
insert into inventory(chara_id,item_id,item_level,item_qty)values(1,2,2,1)
これが私のテーブルに別のエントリを挿入する
とき
です。拍手ガイズ
insert into inventory(chara_id,item_id,item_level,item_qty)values(1,2,0,1)
item_qty = item_qty + 1