Rickert
Rickert

Reputation: 1675

Text together with subquery output

I'm trying to do a WHERE on a text+ subquery output but I get an error. Here is my query

UPDATE labels SET text='bla' WHERE indicator='c_'(SELECT label FROM pages WHERE id='1')

'c_' is the standart text before the label, after it needs to be indicator='c_home' for example.

I tried to get the subquery also within the ' but that didn't work

Upvotes: 0

Views: 109

Answers (1)

rcpayan
rcpayan

Reputation: 535

try like that

UPDATE labels 
SET text='bla' 
WHERE indicator = 
    CONCAT('c_', 
        (SELECT label FROM pages WHERE id='1')
    )

and you can read manual here

Upvotes: 2

Related Questions