Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
One to many relationship INNER JOIN condition
Message
De
14/02/2011 10:15:43
 
 
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Versions des environnements
SQL Server:
SQL Server 2008
Application:
Web
Divers
Thread ID:
01500073
Message ID:
01500098
Vues:
42
>If you want to make sure that all records are enabled, then
>
>select M.Numero
>from Master M inner join ManyToManyTable MM on M.Numero = MM.NoMaster
>inner join ChildTable C on MM.NoChildTable = C.Numero
>group by M.Numero
>having min(case when C.Enabled = 1 then 1 else 0 end) = 1 -- means all records are enabled
>and sum(case when C.Enabled = 1 then 1 else 0 end) = count(C.Numero) -- total number of enabled records = total number of joined records
Unfortunately, this does not work either.
Michel Fournier
Level Extreme Inc.
Designer, architect, owner of the Level Extreme Platform
Subscribe to the site at https://www.levelextreme.com/Home/DataEntry?Activator=55&NoStore=303
Subscription benefits https://www.levelextreme.com/Home/ViewPage?Activator=7&ID=52
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform