Replace values in Column without creating new column

Lynskey08 :

I'm trying to modify one of my queries to select all values in the db, but also replace all values that are either NULL or "-" in the column "RA" with the value "No RA".

    Select *,
    IF(RA IS NULL OR RA='-', 'No RA', RA)
    from dbname

When I do the above command, it's replacing the values but it replaces them in a newly created column called "IF(RA IS NULL OR RA='-', 'No RA', RA)". How can I do by only modifying the existing RA column?
Thank you for your time.

scaisEdge :

just don't use select * but use a proper select using explicit column name for all the columns you need

 Select  IF(RA IS NULL OR RA='-', 'No RA', RA) RA, col2, col3 

    from dbname

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=169175&siteId=1