简体   繁体   English

我在phpmyadmin表中有一个记录列表,我想更改所有记录中一个字段的值

[英]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.

相关问题 我想选择具有相同值的记录,并且joomla的一个用户将其添加到数据库表中 - I want select records that have same value and one user of joomla add it in database table 我有一个字段,我想填充phpmyadmin中的所有行 - I have a field and I want to populate all its rows in phpmyadmin 我想连接数据并显示一个表中的所有记录和另一个表中的一个记录 - I want to join data and display all records from one table and just one record from another table 该查询为表中的所有记录分配一个值,但是我只想将值分配给最后一个记录 - This query assigns a value to all records in the table, but I want to assign the value only to the last record 我想用mysqldump备份表的最后记录 - I want to backup last records of a table with mysqldump 我有两个表 fileA 和 fleB 我想要相似词数据的记录和 fileA 表的总行 - I have two table fileA and fleB i want records of similar words data and total row of fileA table 您是否有一个函数来更改Laravel中特定表中所有记录的特定列的值? - Do you have a function to change the value of a particular column of all records in a particular table in the Laravel? 我想更新表,我已经通过其ID跟踪了所有记录。单击``编辑''后,每个编辑链接上都显示相同(第一个记录数据) - I want to update table i have traced all records by its id.after clicking edit it shows same(1st recorded data) on every edit link 如何在表格中显示所有记录? - How do I display all records in a table? 我想从使用php mysql 24小时发布的表中检索所有记录 - I want to retrieve all the records from a table which were posted 24 hours back using php mysql
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM