Re: intersect function
From: Vishal Parkar (REMOVE_THIS_vgparkar_at_yahoo.co.in)
Date: 02/20/04
- Next message: Darren: "INSERT"
- Previous message: Jerry: "cannot select chinese records"
- In reply to: burke: "intersect function"
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 20 Feb 2004 15:16:01 +0530
hi burke,
I assume you are looking for similar INTERSECT clause of oracle. INTERSECT is not supported in
SQL Server. The alternate option with you would be to use EXISTS in your query. Intersect
clause in oracle will give you the common rows out of 2 SELECT clauses. so following query
will give you the common rows between the 2 selects.
select id, status, member_type
from imis.dbo.name n
where member_record = 1
intersect
select id, status, member_type
from imis_2003_q4.dbo.name n
where member_record = 1
In SQL Server 2000 you can use EXISTS clause to do this, your query can be rewritten as:
select id, status, member_type
from imis.dbo.name x
where member_record = 1
and exists
( select id, status, member_type
from imis_2003_q4.dbo.name n
where member_record = 1
and n.id = x.id and n.status = x.status and n.member_type = x.member_type)
-- Vishal Parkar vgparkar@yahoo.co.in
- Next message: Darren: "INSERT"
- Previous message: Jerry: "cannot select chinese records"
- In reply to: burke: "intersect function"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|