Ask Your Question
0

How can a MySql query be used to set all but one integer field to zero during an insert operation?

asked 2021-08-17 11:00:00 +0000

huitzilopochtli gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2021-05-26 05:00:00 +0000

djk gravatar image

To set all but one integer field to zero during an insert operation in MySql, you can use the following query:

INSERT INTO table_name (field1, field2, field3)
VALUES (value1, 0, 0);

In this example, the fields "field2" and "field3" will be set to zero while "field1" will contain the specified value "value1". To update other fields besides "field1", modify the query to include those fields and set their values to zero.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2021-08-17 11:00:00 +0000

Seen: 9 times

Last updated: May 26 '21