I found this request from the developer:
DELETE FROM [MYDB].[dbo].[MYSIGN] where USERID in
(select USERID from [MYDB].[dbo].[MYUSER] where Surname = 'Rossi');
This query deletes each entry in the MYSIGN table .
The USERID field does not exist in the MYUSER table . If I run only the subquery:
select USERID from [MYDB].[dbo].[MYUSER] where Surname = 'Rossi'
It throws the correct error because the column is missing.
We adjusted the query using the right column, but we did not find out:
- Why does the first request work?
- Why does he delete every entry?
Specifications: the database is located on SQL SERVER 2016 SP1, CU3.
source
share