'Sql query print one record overwrite if both action are present overwrite and insert
enter image description hereOutput gives overwrite when action is insert and overwrite both, When only one row (insert/overwrite) is present it should just give that one row
Solution 1:[1]
CREATE TABLE userData(_id INT, name VARCHAR(50));
INSERT INTO data(id, name) VALUES(1,'abc'),(2,'xyz')
SELECT _id, case WHEN name LIKE '%xyz%' THEN 'xyz' ELSE name end AS Output FROM userData;
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |
