Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Not Exists
Message
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Titre:
Versions des environnements
SQL Server:
SQL Server 2000
Divers
Thread ID:
01219446
Message ID:
01219451
Vues:
7
Can you post some data and desired result from that data?
I am little confused here, two Parent tables and no child one :-).


>What I need:
> Return record(s) that are not found in the Parent Tables
>
>Combined Table has Fields ID,AssemblyId,PartsId
>
>Parent Table One has ID,AssemblyId
>
>Parent Table Two has ID,PartsId
>
>What I tried that returns all records when I want only records that are not in parent tables.
>
>Select *
>FROM Combined
>Where exists
>(
> SELECT a.*
> FROM Combined a
> WHERE somefield<>'2'
> and NOT EXISTS
> (
> SELECT id
> FROM ParentTwo b
> WHERE a.id = b.Id
> and a.PartsId = b.PartsId
> and not exists
> (
> SELECT id
> FROM ParentOne c
> where a.Id = c.Id and a.AssemblyId = c.AssemblyId
> )
> )
>)
>
>Any pointers on where I'm screwing up would be welcomed.
>
>TIA
>
>Jeff
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform