开发者

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜