I am trying to execute a select query where I am trying to change a value.
select * from config where category = 'basic'
For example, I would like the output to show 'general' instead of 'basic' . But I do not want to update all the values โโof 'basic' in 'general'
Is there any way to do this?
Try the following:
SELECT field1, field2, ..., CASE WHEN category = 'basic' THEN 'general' ELSE category END FROM config
or, in this particular case:
SELECT field1, field2, ...., 'general' FROM config WHERE category = 'basic'
Use case .. When the operator resolves your problem
select case when category = 'basic' then 'general' else category end from config
select c.foo, c.bar, 'general' from config c where c.category = 'basic'