You must encapsule the mytable with in a SELECT
update myTable
set closedOrNot =
(case when (SELECT CONCAT(ltiNum,ltiCd) FROM (SELECT * FROM myTable) t1 where updateDate Like '2020-08%'
and CONCAT(ltiNum,ltiCd) in (SELECT CONCAT(ltiNum,ltiCd) FROM (SELECT * FROM myTable) t1 WHERE updateDate Like '2020-07%'
)) then 'existing'
when (SELECT CONCAT(ltiNum,ltiCd) FROM (SELECT * FROM myTable) t1 where updateDate Like '2020-08%'
and CONCAT(ltiNum,ltiCd) not in (SELECT CONCAT(ltiNum,ltiCd) FROM (SELECT * FROM myTable) t1 WHERE updateDate Like '2020-07%'
)) then 'New'
when (SELECT CONCAT(ltiNum,ltiCd) FROM (SELECT * FROM myTable) t1 where updateDate Like '2020-07%'
and CONCAT(ltiNum,ltiCd) not in (SELECT CONCAT(ltiNum,ltiCd) FROM (SELECT * FROM myTable) t1 WHERE updateDate Like '2020-08%'
)) then 'Closed'
end);
So mysql thinks, that this is another table, but you are basically changing all the rows, because you didn't use a WHERE clause, so that it could happen that further the road, the results could be changed
Basically everything is correct what o told you but your query has another problem
CREATE TABLE myTable (
`ltiNum` INTEGER,
`ltiCd` VARCHAR(1),
`updateDate` VARCHAR(10),
`closedOrNot` VARCHAR(8)
);
INSERT INTO myTable
(`ltiNum`, `ltiCd`, `updateDate`, `closedOrNot`)
VALUES
('1', 'A', '2020-07-01', 'NULL'),
('2', 'B', '2020-07-01', 'Closed'),
('3', '0', '2020-07-01', 'NULL'),
('4', 'D', '2020-07-01', 'NULL'),
('5', 'E', '2020-07-01', 'NULL'),
('1', 'A', '2020-08-01', 'existing'),
('3', '0', '2020-08-01', 'existing'),
('4', 'D', '2020-08-01', 'existing'),
('5', 'E', '2020-08-01', 'existing'),
('6', 'F', '2020-08-01', 'New');
update myTable
set closedOrNot =
(case when (SELECT CONCAT(ltiNum,ltiCd) FROM (SELECT * FROM myTable) t1 where updateDate Like '2020-08%'
and CONCAT(ltiNum,ltiCd) in (SELECT CONCAT(ltiNum,ltiCd) FROM (SELECT * FROM myTable) t1 WHERE updateDate Like '2020-07%'
)) then 'existing'
when (SELECT CONCAT(ltiNum,ltiCd) FROM (SELECT * FROM myTable) t1 where updateDate Like '2020-08%'
and CONCAT(ltiNum,ltiCd) not in (SELECT CONCAT(ltiNum,ltiCd) FROM (SELECT * FROM myTable) t1 WHERE updateDate Like '2020-07%'
)) then 'New'
when (SELECT CONCAT(ltiNum,ltiCd) FROM (SELECT * FROM myTable) t1 where updateDate Like '2020-07%'
and CONCAT(ltiNum,ltiCd) not in (SELECT CONCAT(ltiNum,ltiCd) FROM (SELECT * FROM myTable) t1 WHERE updateDate Like '2020-08%'
)) then 'Closed'
end);
Subquery returns more than 1 row
SELECT CONCAT(ltiNum,ltiCd)
FROM (SELECT * FROM myTable) t1
where updateDate Like '2020-08%'
and CONCAT(ltiNum,ltiCd) in (SELECT CONCAT(ltiNum,ltiCd) FROM (SELECT * FROM myTable) t1 WHERE updateDate Like '2020-07%' )
| CONCAT(ltiNum,ltiCd) |
| :------------------- |
| 1A |
| 30 |
| 4D |
| 5E |
SELECT CONCAT(ltiNum,ltiCd) FROM (SELECT * FROM myTable) t1 where updateDate Like '2020-08%'
and CONCAT(ltiNum,ltiCd) not in (SELECT CONCAT(ltiNum,ltiCd) FROM (SELECT * FROM myTable) t1 WHERE updateDate Like '2020-07%'
)
| CONCAT(ltiNum,ltiCd) |
| :------------------- |
| 6F |
SELECT CONCAT(ltiNum,ltiCd) FROM (SELECT * FROM myTable) t1 where updateDate Like '2020-07%'
and CONCAT(ltiNum,ltiCd) not in (SELECT CONCAT(ltiNum,ltiCd) FROM (SELECT * FROM myTable) t1 WHERE updateDate Like '2020-08%'
)
| CONCAT(ltiNum,ltiCd) |
| :------------------- |
| 2B |
db<>fiddle here
As you can see the first CASE retursn 4 results, so that your construction doesn't work-