Y
Y
Yuri Petrashevich2014-05-29 21:12:25
MySQL
Yuri Petrashevich, 2014-05-29 21:12:25

How in MySQL, when using INSERT, insert a value into one of the fields: either 1 or -1 ?

Actually the title is the whole question, is it possible to do this?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Kuleshov, 2014-05-29
@BelCoder

IF (expr1,expr2,expr3)

INSERT INTO `table` (a) VALUES (IF( ...условие... , 1, -1));

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question