I want to insert values in a column based on the following conditions. Name of the column to be inserted is project_renewal.
If decimal exists in project_code, insert the numbers after decimals.
SELECT substring_index(project_code, '.', -1)
FROM projects where
project_code like '%.%'
If no decimal, insert 0.
SELECT project_code
FROM projects where
project_code not like '%.%'
Order of insert must be the same as the order of reading values from project_code.
Aucun commentaire:
Enregistrer un commentaire