Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
One to many relationship INNER JOIN condition
Message
From
14/02/2011 09:47:38
 
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Environment versions
SQL Server:
SQL Server 2008
Application:
Web
Miscellaneous
Thread ID:
01500073
Message ID:
01500092
Views:
63
>Could you post some example data and desired result?

Here is an example, where I added Sergey's logic in it:
SELECT Master.Numero
FROM (SELECT Master.Numero FROM Master 
WHERE EXISTS (SELECT 1 FROM ManyToManyTable
 INNER JOIN ChildTable ON ManyToManyTable.NoChildTable=ChildTable.Numero 
 WHERE Master.Numero=ManyToManyTable.NoMaster
 HAVING COUNT(*)=SUM(CASE WHEN ChildTable.Enabled=1 THEN 1 ELSE 0 END))
GROUP BY Master.Numero) Temp 
INNER JOIN Master ON Temp.Numero=Master.Numero 
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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform