Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
One to many relationship INNER JOIN condition
Message
De
14/02/2011 13:58:04
 
 
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:
01500136
Vues:
44
>Try this (suggested by Peter Larsson):
>
>
>SELECT                   m.Numero
>FROM                     dbo.ChildTable AS c
>LEFT JOIN   dbo.ManyToManyTable AS mm ON mm.NoChildTable = c.Numero
>LEFT JOIN   dbo.[Master] AS m ON m.Numero = mm.NoMaster
>GROUP BY    m.Numero
>HAVING                   COUNT(c.Numero) <= COUNT(m.Numero)
>                         AND MIN(CASE WHEN c.[Enabled] = 1 THEN 1 ELSE 0 END) = 1
Thanks, that works.
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