[thelist] Weird SQL problem with INTERSECT and UNION

ted serbinski tss24 at cornell.edu
Wed Apr 2 13:47:54 CST 2003

> when you INTERSECT those two queries, you are asking for
> only those rows which are in both sets

Exactly... and that is the exact result I needed. You see, this question
relates to a project I'm designing for my database class. We have this
database of Parts and Suppliers and the interface is just a search

A user adds contraints (price > $0, price>$10) ect... and there is no limit
on the number of contraints, so that is why I figured INTERSECT would work
good at dynamically creating these queries.

However since INTERSECT was not supported I did take a step back and
realize, having 2 queries like that was redundant. So instead of set it up
to be (WHERE price > 0 AND price > 10) and just kept tacking them onto the
end of the query string.

Works great now, although I don't think the project is a great real world

> if any of this is not clear, just holler

Thanks for clearing up the DISTINCT / INTERSECT stuff.


More information about the thelist mailing list