在不指定列名的情况下更新MySQL [英] Update MySQL without specifying column names

查看:93
本文介绍了在不指定列名的情况下更新MySQL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想更新一个mysql行,但是我不想指定所有的列名. 该表有9行,我一直想以正确的顺序更新最后7行. 这些是字段

I want to update a mysql row, but I do not want to specify all the column names. The table has 9 rows and I always want to update the last 7 rows in the right order. These are the Fields

id
projectid
fangate
home
thanks
overview
winner
modules.wallPost
modules.overviewParticipant

有什么方法可以在不指定其名称的情况下更新最后几条记录? 使用INSERT语句,可以很容易地做到这一点:

Is there any way I can update the last few records without specifying their names? With an INSERT statement this can be done pretty easily by doing this:

INSERT INTO `settings`
VALUES (NULL, ...field values...)

所以我希望我可以做这样的事情:

So I was hoping I could do something like this:

UPDATE `settings`
VALUES (NULL, ...field values...)
WHERE ...statement...

但不幸的是,这不起作用.

But unfortunately that doesn't work.

推荐答案

您不能.您始终必须指定列名,因为UPDATE不会编辑整行,它会编辑指定列. 这是带有UPDATE语法的链接: http://dev.mysql.com/doc/refman/5.0/en /update.html

You can't. You always have to specify the column names, because UPDATE doesn't edit a whole row, it edits specified columns. Here's a link with the UPDATE syntax: http://dev.mysql.com/doc/refman/5.0/en/update.html

这篇关于在不指定列名的情况下更新MySQL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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