Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 SQL MINUS or INTERSECT statement

Author  Topic 

Nebby
Starting Member

9 Posts

Posted - 2005-05-04 : 05:31:51
Hi, i want my regjaar and regsem from ziekenhuisverblijf where the combination of this 2 fields are not in diagnose

like this

ziekenhuisverblijf diagnose
regjaar regsem regjaar resem
2000 1 2000 1
2000 2

now I want this regjaar 2000 en regsem 2 as return value
so i did this sql query:

select regjaar, regsem from dbo.ziekenhuisverblijf
MINUS
select regjaar, regsem from dbo.diagnose

but this didn't worked in sql query analyzer,
so I tried:

select regjaar, regsem from dbo.ziekenhuisverblijf
INTERSECT
select regjaar, regsem from dbo.diagnose

but this alse didn't worked

what can i do?

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2005-05-04 : 05:35:01
try inner join
read about it in BOL = Books Online = sql server help

Go with the flow & have fun! Else fight the flow
Go to Top of Page

Nebby
Starting Member

9 Posts

Posted - 2005-05-04 : 07:27:13
pfff,

its not working with joins...

can sombody help me?

I need this verry fast
Go to Top of Page

byrmol
Shed Building SQL Farmer

1591 Posts

Posted - 2005-05-04 : 07:28:59
- Look for usage in BOL

MINUS ~ NOT EXISTS
INTERSECT = INNER JOIN

DavidM

A front-end is something that tries to violate a back-end.
Go to Top of Page
   

- Advertisement -