我的数据库中有一个表选项,我有列“question_id”。在我的表中,我有大约1000条记录。
我在表格中对colum“question_id”的要求是什么?无论我在哪里,我想要补充131和2,132,1,3,133等等,直到1000条记录。
我试着做那样的事情......
UPDATE `dta`.`options` SET `question_id` = '132' WHERE `id` > 435 AND `question_id` = 1
搜索某种函数或运算符。 请帮帮我!!
示例: -
UPDATE `dta`.`questions` SET `quiz_id` = '7' WHERE `id` > 131 AND `quiz_id` = 1
UPDATE `dta`.`questions` SET `quiz_id` = '8' WHERE `id` > 131 AND `quiz_id` = 2
UPDATE `dta`.`questions` SET `quiz_id` = '9' WHERE `id` > 131 AND `quiz_id` = 3
UPDATE `dta`.`questions` SET `quiz_id` = '10' WHERE `id` > 131 AND `quiz_id` = 4
UPDATE `dta`.`questions` SET `quiz_id` = '11' WHERE `id` > 131 AND `quiz_id` = 5
UPDATE `dta`.`questions` SET `quiz_id` = '12' WHERE `id` > 131 AND `quiz_id` = 6
答案 0 :(得分:1)
UPDATE dta.options
SET question_id = question_id + 130
order by question_id
limit 1000
答案 1 :(得分:1)
你能做到吗
UPDATE `dta`.`options` SET `question_id` = question_id + 130 WHERE `id` > 435