我正在使用复选框插入汽车。我想从列表中删除奥迪汽车。我怎样才能实现这一目标
+----+------------+-----------------+----------+---------+------------+----------+
| id | sms | Cars | usertype | noprice | regdate | time |
+----+------------+----------+----------+---------+------------+----------+------
| 82 | hello boys | BMW Audi Maruti | Driver | 50 | 2014-08-24 | 09:11:50 |
+----+------------+-----------------+----------+---------+------------+----------+
预期结果
+----+------------+------------+----------+---------+------------+----------+
| id | sms | Cars | usertype | noprice | regdate | time |
+----+------------+----------+----------+---------+------------+----------+--
| 82 | hello boys | BMW Maruti | Driver | 50 | 2014-08-24 | 09:11:50|
+----+------------+------------+----------+---------+------------+----------+
答案 0 :(得分:1)
您可以使用replace()
功能更新专栏
update table set cars = replace(cars ,'Audi','') where id = 82
或者更好地将汽车与单个用户关联在一个单独的表中,其中包含汽车名称和相关的用户ID,每个汽车和用户关系在一个单独的行中