开发者

What is the problem with my sql query?

开发者 https://www.devze.com 2023-01-31 11:36 出处:网络
What is the prob开发者_Go百科lem with my sql query ? UPDATE template SET template = template . \"hello\"

What is the prob开发者_Go百科lem with my sql query ?

UPDATE template SET template = template . "hello"


Concatenation in MySQL uses a + i believe, not a . (that's php). Alternatively, you could use CONCAT:

UPDATE template SET template=CONCAT(template,'hello');


Where are you making this query? If it's just in MySQL, they don't use . as the concatenation operator like PHP does. Look into CONCAT instead if this is just a SQL query.

It's unclear from your question and your tags whether or not we should help you with PHP syntax or MySQL's SQL syntax.


UPDATE template SET template = template . "hello"

update tablename
set fieldname=new field value

[1] template is a table name or field name? if fieldname then you have to use below syntex:

**update tablename
set template = concat(template,'.', 'hello')**


If all you want to do is replace all of the rows in template to = "hello" then

UPDATE template 
SET template = 'hello'

(Edit replaced quotes with single quotes)

0

精彩评论

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