Question Jude Mukkadayil · Mar 12, 2020

Intersect in Cache Database

Hi,

        What is the alternative for INTERSECT in cache. I tried Intersect but not working.

Thanks for suggestions.

thanks

Jude

Comments

Peter Steiwer · Mar 13, 2020

Have you tried using a JOIN to get the desired results?

If you have already tried using a JOIN, what are you seeing that is not expected?

0
Laura Cavanaugh  May 19, 2020 to Peter Steiwer

Hi Peter and Jude,

I am also trying to use the idea of INTERSECT. Instead of intersect, I'm using a RIGHT JOIN or a LEFT JOIN, but the query plan isn't using the faster table to loop through the data.

I found that changing the Group By to the table that I want the query plan to use for the loop, made it much faster.

0
Dorian Tetu · Dec 6, 2023

Hi, i know that's an old post but still,
I also needed to use an INTERSECT statement and I managed to replace it with "IN"
example:
SELECT ID FROM Table
WHERE Row=Name AND ID IN (
           SELECT ID FROM Table
           WHERE Row=Surname)
Instead of:

SELECT ID FROM Table
WHERE Row=Name
INTERSECT
SELECT ID FROM Table
WHERE Row=Surname
Hope that can help anyone with the same issue ^^

0