Can anyone please help me. I have paid for people to fix this but no one can do it.
I simply want to delete the rows in a table that do not have matching rows in a union.
This works and returns the 2640 rows I want deleted:
And this works (if I make a table of the results above):
So can anyone tell me why this returns the entire table??
I just want to delete 2640 rows... I will do literally anything for help.
I simply want to delete the rows in a table that do not have matching rows in a union.
This works and returns the 2640 rows I want deleted:
Code:
SELECT * from Shares
Left JOIN (
SELECT Indices.Code
FROM Indices
UNION
SELECT ETFs.Code
FROM ETFs
UNION SELECT GICS.Code
FROM GICS
) as Allcodes
ON Allcodes.Code = Shares.Code
WHERE Allcodes.Code Is Null
And this works (if I make a table of the results above):
Code:
DELETE *
FROM Shares
WHERE EXISTS
(
SELECT *
FROM junk
WHERE junk.Code = Shares.Code
)
So can anyone tell me why this returns the entire table??
Code:
SELECT *
FROM Shares
WHERE EXISTS
(
SELECT * from Shares
Left JOIN (
SELECT Indices.Code
FROM Indices
UNION
SELECT ETFs.Code
FROM ETFs
UNION SELECT GICS.Code
FROM GICS
) as Allcodes
ON Allcodes.Code = Shares.Code
WHERE Allcodes.Code Is not Null
)
I just want to delete 2640 rows... I will do literally anything for help.