Veljko
Veljko

Reputation: 1808

Combine UPDATE and SELECT statement - adding blank space on the same column

I want to do something like this but always getting error so code is not correct. I want to update the same column with blank space.

update table 
set (select line as line1 from  table where id='100')=line1+' ' 
where id='100'

Thanks

Upvotes: 0

Views: 394

Answers (2)

Quassnoi
Quassnoi

Reputation: 425341

In DB2 (assumed from your previous questions, works in MySQL too):

UPDATE  table
SET     line = CONCAT(line, ' ')
WHERE   id = '100'

Upvotes: 4

triclosan
triclosan

Reputation: 5714

update table 
set line=line+' ' 
where id=100

something like this?

Upvotes: 2

Related Questions