Reputation: 569
I'm trying to use SELECT UUID()
INSIDE an insert query.
Here is my uery
INSERT INTO `posts`(`post_id`, `user_id`, `content`, `time`) VALUES (SELECT uuid(),1,'my content',mytime)
I'm getting error a comma or a closing bracket was expected mysql near uuid
Upvotes: 3
Views: 2798
Reputation: 28499
uuid
is a function, that you can use on its own without having to write select.
INSERT INTO `posts`(`post_id`, `user_id`, `content`, `time`) VALUES (uuid(),1,'my content',mytime)
Upvotes: 8