Log in

View Full Version : Delete Query with two joins to a Query



ry94080
06-14-2024, 06:59 AM
Hi all,

I'm trying to create a DELETE query with a table that has two joins to a Query. Is this possible?

This is what I have so far but is not working.


DELETE *FROM LV_TEST_UNQ
WHERE EXISTS
(SELECT *
FROM vMST_Max_NotLV
WHERE vMST_Max_NotLV.AccessionNumber = LV_TEST_UNQ.AccNo AND vMST_Max_NotLV.OrderCodes = LV_TEST_UNQ.TestCode);


Any ideas welcomed

ry94080
06-14-2024, 01:55 PM
I think I just figured this out via this query:



DELETE *FROM LV_TEST_UNQ
WHERE EXISTS
(SELECT *
FROM vMST_Max_NotLV
WHERE vMST_Max_NotLV.AccessionNumber = LV_TEST_UNQ.AccNo)
AND EXISTS
(SELECT *
FROM vMST_Max_NotLV
WHERE vMST_Max_NotLV.OrderCodes = LV_TEST_UNQ.TestCode);

Michael J. M
10-03-2024, 09:23 PM
Do you have a more optimized way to execute this DELETE query without using two EXISTS conditions?

georgiboy
10-03-2024, 10:17 PM
Hi Michael J. M,

I have removed the spam from your signature, please don't spam here.

If you add it back you will be banned from the forum.