2017-10-17 133 views
3

我试图在插入查询中使用SELECT UUID()。 这里是我的uery在插入语句中选择UUID()MySQL

INSERT INTO `posts`(`post_id`, `user_id`, `content`, `time`) VALUES (SELECT uuid(),1,'my content',mytime) 

我收到提示a comma or a closing bracket was expected mysql near uuid

回答

5

uuid是一个功能,你可以对自己使用,而无需编写选择。

INSERT INTO `posts`(`post_id`, `user_id`, `content`, `time`) VALUES (uuid(),1,'my content',mytime) 
+2

另外,我想你可以删除'VALUES('和')' – Strawberry