1

Two tables,

agent(agent_id, agent_real_name, .....)
blog(blog_id, blog_agent_id, blog_name, ...)

Now I want to set the blog_name as agent_real_name + "'s blog" I used following SQL sentence but failed,

update blog, agent set blog_name = agent_real_name '\'s blog' where agent_id = 31

PS: 31 is the id of a agent

What's wrong?

Thanks.

2 Answers 2

2
UPDATE blog b INNER JOIN agent a
ON a.agent_id = b.blog_agent_id
SET b.blog_name = CONCAT(a.agent_real_name,'\'s blog') 
WHERE a.agent_id = 31
Sign up to request clarification or add additional context in comments.

Comments

1

try to use: update blog, agent set blog_name = concat(agent_real_name, '\'s blog') where agent_id = 31

Comments

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.