Subject | RE: [firebird-support] Re: intersect operation |
---|---|
Author | Nigel Weeks |
Post date | 2004-07-21T23:46:43Z |
> I'm looking for a way to get records that exists in two separateSo the following weren't suitable?
> 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?
Students majoring in math OR CS:
select Student
from MajorsIn
where Major IN ('math','CS');
Students majoring in math OF CS (alternative method):
select Student
from MajorsIN
where Major = 'math' OR Major = 'CS'
Students majoring in math AND CS:
select Student
from MajorsIN
where Major = 'math' AND Major = 'CS'
Nige.