MySQL Inserting into locked aliased table
I am trying to insert data into a InnoDB MySQL table which is locked using an alias and I can开发者_如何学Pythonnot for the life of me get it to work!
The following works:
LOCK TABLES Problems p1 WRITE, Problems p2 WRITE, Server READ;
SELECT * FROM Problems p1;
UNLOCK TABLES;
But try and do an insert and it doesn't work (it claims there is a syntax error round the 'p1' in my INSERT):
LOCK TABLES Problems p1 WRITE, Problems p2 WRITE, Server READ;
INSERT INTO Problems p1 (SomeCol) VALUES(43534);
UNLOCK TABLES;
Help please!
Just lock both the aliased and the non-aliased table es: LOCK TABLES Problems WRITE, Problems p1 WRITE, Problems p2 WRITE, Server READ;
Use INSERT INTO Problems (SomeCol) VALUES(43534);
No p1...
just faced the same problem, unfortunately INSERT INTO table_name [AS alias] VALUES ...
is not supported in mysql
精彩评论