Subject Re: intersect operation
Author vbj34
I'm looking for a way to get records that exists in two separate
lists (not necessarily tables). For example if I have 2 sql queries
as such:

(select Student
from MajorsIn
where Major='math')

(select Student
from MajorsIn
where Major='CS')

how to generate a list of the students majoring in both math and CS?

--- In firebird-support@yahoogroups.com, Svein Erling Tysvær
<svein.erling.tysvaer@k...> wrote:
> --- In firebird-support@yahoogroups.com, "vbj34" <vbj34@y...> wrote:
> > Hi, is it possible to perform set intersect operation with
Firebird
> > SQL? Thanks.
>
> Is this a difficult way to ask whether it is possible to return
only
> records that exists in two separate tables? If so, it is simply a
> matter of doing
>
> SELECT <something>
> FROM <table1>
> JOIN <table2> ON <table2.field1> = <table1.field1>
>
> or (depending on what you want)
>
> SELECT <something>
> FROM <table1>
> WHERE EXISTS(SELECT * FROM <table2> WHERE <table2.field1> = <table1.
> field1>)
>
> If this is not what you are asking, please rephrase your question
so
> that it is easier for us to understand.
>
> HTH,
> Set