[英]I have a list of records in a phpmyadmin table, I want to change the value of one field in all the records
I have a phpmyadmin database, I have tables with records in them, if i select a bunch of records and then hit edit it give me a printout of all the records, but i want to change ONE field in one column for all the records checked without having to scroll and change EVERY record and then hit "go" 我有一个phpmyadmin数据库,如果其中有一组记录,然后单击编辑,它就会给我所有记录的打印输出,但是我想在所有检查的记录的一栏中更改一个字段无需滚动和更改每个记录,然后单击“开始”
any idea how to do that 任何想法如何做到这一点
we are talking about thousands of records, I need to just change ONE field column from "-3000" to "0" 我们正在谈论数千条记录,我只需要将一个字段列从“ -3000”更改为“ 0”
Tried getting help in #PHPMYADMIN in IRC but everyone was sleeping i think 试图在IRC中的#PHPMYADMIN中获得帮助,但我想每个人都在睡觉
You don't have a phpMyAdmin database: you have a MySQL database and you use phpMyAdmin as an administrative interface. 您没有phpMyAdmin数据库:您有MySQL数据库,并且使用phpMyAdmin作为管理界面。
This distinction is important because with every relational database you can use SQL to insert/update records in your tables. 这种区别很重要,因为对于每个关系数据库,您都可以使用SQL在表中插入/更新记录。 That is exactly what phpMyAdmin does: under the hood it uses SQL to change the content of your tables. 这正是phpMyAdmin所做的:在后台,它使用SQL来更改表的内容。
Using SQL is a trivial thing changing thousands of records with a single statement, for example if the table is called atable
and the column is called acolumn
, you could do an update like this: 使用SQL是一件很简单的事情,只需一条语句即可更改数千条记录,例如,如果表被称为atable
且列被称为acolumn
,则可以执行如下更新:
UPDATE `atable` SET `acolumn`=-3000 WHERE `acolumn`=0;
phpMyAdmin allows you to execute SQL code directly, but since it looks like this is the first time you try this, I strongly advise to make a backup first. phpMyAdmin允许您直接执行SQL代码,但是由于这是您第一次尝试执行此操作,因此强烈建议您先进行备份。
phpmyadmin ships with a SQL editor, which you can write SQL queries and run it on the current active database. phpmyadmin附带一个SQL编辑器,您可以编写SQL查询并在当前的活动数据库上运行它。 It would make your task easier. 这将使您的任务更加轻松。
With the query here below, you can change the column content -3000 to 0. 通过下面的查询,您可以将列内容-3000更改为0。
UPDATE
your_table_to_change
SET
columname = 0
WHERE
columname = -3000;
The above query will update table your_table_to_change
at column columname
to 0 if the column-value is -3000. 上述查询将更新表your_table_to_change
在柱columname
到0,如果列值是-3000。 If you have another conditions to select which rows should be updated, please use AND other_condition
in the WHERE
clause. 如果您还有其他条件来选择应更新的行,请在WHERE
子句中使用AND other_condition
。
Without the exact database structure and condition it's a bit hard to answer your question, but I will try anyways. 没有确切的数据库结构和条件,很难回答您的问题,但是我还是会尝试的。
You say that you have selected a bunch of record, so not all records of that table. 您说您选择了一堆记录,所以不是该表的所有记录。 You can change one column of all by using this query. 您可以使用此查询更改所有列。 I presume you know how to do that in phpmyadmin. 我想你知道如何在phpmyadmin中做到这一点。
UPDATE table SET column='value' WHERE otherColums='filteritbythis'
If you want to change all the record of the table, you can easily drop the WHERE statement 如果要更改表的所有记录,可以轻松删除WHERE语句
UPDATE table SET column='value'
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.