I have a column-City, i want to create a new column - Metro, i want it to check if city in('x','y','z') then Metro='Metro' else 'Non metro'
ALTER TABLE sales ADD COLUMN Metro_city VARCHAR(45) GENERATED ALWAYS AS (IF (CITY in('Mumbai ','Delhi' , 'Bangalore') then Metro_city='Metro') ('Non-Metro' end if)) STORED;
i also have another set of values to put into case ,when then but i am guessing if i make this work , that will too. i want it to store into the table and not a select query
Aucun commentaire:
Enregistrer un commentaire