Re: intersect function

From: Ray Higdon (sqlhigdon_at_nospam.yahoo.com)
Date: 02/20/04


Date: Thu, 19 Feb 2004 22:16:26 -0500

Intersect is for Analysis services, use UNION or UNION ALL to not eliminate
duplicates.

> select id, status, member_type
> from imis.dbo.name n
> where member_record = 1
>
> union
>
> select id, status, member_type
> from imis_2003_q4.dbo.name n
> where member_record = 1

also, from BOL:
The result sets combined using UNION must all have the same structure. They
must have the same number of columns, and the corresponding result set
columns must have compatible data types.

HTH

-- 
Ray Higdon MCSE, MCDBA, CCNA
---
"burke" <anonymous@discussions.microsoft.com> wrote in message
news:1298b01c3f73e$44d48fc0$a101280a@phx.gbl...
> i just came across the "intersect" function and can't get
> it to work.  i'm familiar with "union".
>
> i've copied the example from books online and i get the
> following error:
>
> [Microsoft][ODBC SQL Server Driver]Syntax error or access
> violation
>
>
> i've tried to substitute "union" with "intersect" in a
> union statement that works and get the following error:
>
> Server: Msg 156, Level 15, State 1, Line 5
> Incorrect syntax near the keyword 'intersect'.
>
> heres the sample statement:
> 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
>
> we're on sql server 2000
>
> thanks for any help.


Relevant Pages

  • Re: Are the following set operations true?
    ... >C in (A intersect B), C in (A union B),. ... disproofs. ... here are some basic questions you should be able to answer before ...
    (sci.math)
  • Re: algorithm to INVERT a multiarea selection ?
    ... specialcells with the union to return the inverse. ... > Then create an array of same dimensions... ... much faster then checking intersect during a 'normal' loop. ... > moment..and I'm pretty sure there must be some nice routines out there! ...
    (microsoft.public.excel.programming)
  • Re: Possible Proof of the Lusin-Purves Theorem
    ... >> they should converge in the original topology on XxY, ... union of singletons, thus Borel. ... = clintersect ^c ...
    (sci.math)
  • Re: Possible Proof of the Lusin-Purves Theorem
    ... >> they should converge in the original topology on XxY, ... union of singletons, thus Borel. ... = clintersect ^c ...
    (sci.logic)
  • Ping-Pong Question
    ... G is a group acting on X. G is generated ... E = A intersect B. And it's not hard to ... union of gfor g in G is all of X? ... just algebra it would be keen if this ...
    (sci.math)