Subject | Re: intersect operation |
---|---|
Author | Svein Erling Tysvær |
Post date | 2004-07-22T08:39:49Z |
--- In firebird-support@yahoogroups.com, "vbj34" <vbj34@y...> wrote:
select distinct M1.Student
from MajorsIn M1
join MajorsIn M2 on M1.Student = M2.Student
where M1.Major = 'math'
and M2.Major = 'CS'
HTH,
Set
> I'm looking for a way to get records that exists in two separateUse aliases:
> 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?
select distinct M1.Student
from MajorsIn M1
join MajorsIn M2 on M1.Student = M2.Student
where M1.Major = 'math'
and M2.Major = 'CS'
HTH,
Set