我有一个phpmyadmin表中的记录列表,我想更改所有记录中一个字段的值
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"
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"
Tried getting help in #PHPMYADMIN in IRC but everyone was sleeping i think
我有一个phpmyadmin数据库,我有表中包含记录,如果我选择一堆记录然后点击 编辑它给我一个打印输出的所有记录,但我想在一列中更改一个字段,检查所有记录,而不必滚动和更改每条记录,然后点击“go” p>
任何想法如何做到 p>
我们正在谈论成千上万的记录,我只需将一个字段列从“-3000”更改为“0” p> \ n
尝试在IRC的#PHPMYADMIN获得帮助,但每个人都在睡觉我认为 p> div>
You don't have a phpMyAdmin database: you have a MySQL database and you use phpMyAdmin as an administrative interface.
This distinction is important because with every relational database you can use SQL to insert/update records in your tables. That is exactly what phpMyAdmin does: under the hood it uses SQL to change the content of your tables.
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:
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 ships with a SQL editor, which you can write SQL queries and run it on the current active database. It would make your task easier.
With the query here below, you can change the column content -3000 to 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. If you have another conditions to select which rows should be updated, please use AND other_condition
in the WHERE
clause.
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.
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
UPDATE table SET column='value'