I'm trying to do some string manipulation with a particular column that has cells with records like '2,6' or '3,4'. I'm trying to CAST this to an INT so I can perform aggregations (sum, avg, etc).
```
DROP TABLE IF EXISTS customer_orders;
CREATE TABLE customer_orders (
"order_id" INTEGER,
"customer_id" INTEGER,
"pizza_id" INTEGER,
"exclusions" VARCHAR(4),
"extras" VARCHAR(4),
"order_time" TIMESTAMP
);
INSERT INTO customer_orders
("order_id", "customer_id", "pizza_id", "exclusions", "extras", "order_time")
VALUES
('1', '101', '1', '', '', '2020-01-01 18:05:02'),
('2', '101', '1', '', '', '2020-01-01 19:00:52'),
('3', '102', '1', '', '', '2020-01-02 23:51:23'),
('3', '102', '2', '', NULL, '2020-01-02 23:51:23'),
('4', '103', '1', '4', '', '2020-01-04 13:23:46'),
('4', '103', '1', '4', '', '2020-01-04 13:23:46'),
('4', '103', '2', '4', '', '2020-01-04 13:23:46'),
('5', '104', '1', 'null', '1', '2020-01-08 21:00:29'),
('6', '101', '2', 'null', 'null', '2020-01-08 21:03:13'),
('7', '105', '2', 'null', '1', '2020-01-08 21:20:29'),
('8', '102', '1', 'null', 'null', '2020-01-09 23:54:33'),
('9', '103', '1', '4', '1, 5', '2020-01-10 11:22:59'),
('10', '104', '1', 'null', 'null', '2020-01-11 18:34:49'),
('10', '104', '1', '2, 6', '1, 4', '2020-01-11 18:34:49');
```
As you can see, the exclusions and extras columns have the literal string 'null'. I was hoping this query would resolve it:
```
update customer_orders
set extras = case when extras is null then replace(extras, null , '')
when extras like 'null' then replace(extras, 'null','')
else extras
end;
```
However, the results aren't what I was hoping for:
![image.png](/image?hash=ca8eac279ced01a075067cd4c7624175073cf6fb92190a8d28a74dd4cc477978)
The 'NULL' is still there for some reason. Any ideas why?