3

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

1 Answer 1

8

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)
Sign up to request clarification or add additional context in comments.

1 Comment

Alternatively, I guess you could remove VALUES ( and )

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.