将 mysql 表的所有列设置为特定值 [英] Set all the columns of a mysql table to a particular value

查看:56
本文介绍了将 mysql 表的所有列设置为特定值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有什么方法可以一次性将特定记录的 mysql 表的所有列更新为特定值.

hIs there any way to update all the columns of a mysql table for a particular record in one go to a particular value.

例如我有一个大约有 70 列的表,它们在创建表时默认设置为 0,当我通过 PHPmyadmin 添加新记录时,只需填写一两个值并提交,所有其他字段都是设置为 0 ,但我想将所有字段设置为 1很多次,所以我需要通过 PHPmyadmin 将所有列单独设置为 1

For e.g. I have a table that has around 70 columns , and they are by default set to 0 at the time of creating the table,when I add a new record via PHPmyadmin by just filling in one or two values and submitting it all the other fields are set to 0 , but I want to set all the fields to 1 many times ,so I need to set all the columns to 1 individually via PHPmyadmin

为了加快进程和我试过

UPDATE tablename SET * = '1' WHERE id = '2' ,但它不起作用.

如果有人能提供类似的解决方案,那就太好了.

If anyone can provide a solution on similar lines , it would be great.

有没有不指定 SQL 语句中所有 70 列的方法?这就是我要找的.我知道如何在 SQL 语句中正常更新指定列.谢谢.

Is there a way without specifying all the 70 columns in the SQL statement? that what I am looking for. I do know how to update normally specifying columns in the SQL statement. Thank you.

推荐答案

您必须为更新语句中的每一列命名.

You have to name each column in an update statement.

这篇关于将 mysql 表的所有列设置为特定值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆