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
 SQL Server Development (2000)
 Refererring to a foreign key in SELECT

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2002-01-21 : 10:07:53
Santiago writes "I have a table (WEB) with a unique restriction that is a combination of 3 fields. This is a primary key with the name "PK_WEB". I want to add from a second table (WEB2) with the same structure and the same primary key (but nammed "PK_WEB2") only the records that are not repeated in the frist table (have different primary keys).
Is there any way to SELECT from the WEB2 table only the records that are not repeated in WEB table?"

Nazim
A custom title

1408 Posts

Posted - 2002-01-21 : 10:22:45
if i have understood your question properly , this should help you

select * from web2
where pk_web2 not in (select pk_web from web)

--------------------------------------------------------------
Dont Tell God how big your Problem is , Tell the Problem how Big your God is



Edited by - Nazim on 01/21/2002 10:26:26
Go to Top of Page
   

- Advertisement -