U
U
utyfua2016-06-18 08:40:17
MySQL
utyfua, 2016-06-18 08:40:17

Select in the middle of an INSERT query?

Good morning.
Wrote sql request but does not plow.

INSERT INTO `tab`(`order`,`type`) VALUES ((SELECT count(*) FROM `tab` WHERE `type`=1)+1,1)
#1093 - It is not allowed to specify the table 'tab' in the list of tables FROM to make changes to it
But why?
thanks for answers

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
AlikDex, 2016-06-18
@utyfua

INSERT INTO `tab` (`order`, `type`) SELECT COUNT(*)+1, 1 FROM `tab`

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question