We have two tables for "Physical Location" and "Stores". One Physical Location can have multiple stores. Each Store can be either Active or Inactive.
How would we write a query to find those 'Physical Locations' that has no active Stores associated to it?
PhysicalLocation
LocationId LocationAddress
100 Address1
101 Address2
102 Address3
Store
StoreID LocationId Status
100A 100 Active
100B 100 Inactive
101C 101 Inactive
102D 101 Inactive
I have tried something like the below.
Select * from PhysicalLocation where LocationId IN
(Select LocationId from Store where Status <> 'Active')
My expected result is
LocationId LocationAddress
101 Address2
Since this location has only inactive stores