I have table for tenants
Id | Name |
---|---|
1 | Tenant1 |
2 | Tenant2 |
3 | Tenant3 |
And table for Pricing Tiers
Id | Name | TenantId |
---|---|---|
1 | PricingTier1 | 1 |
2 | PricingTier1 | 1 |
I need to create SQL script that get all tenants that don’t have pricing Tiers
For example in this example it must be Tenant 2 and Tenant 3
I tried to get it like this
SELECT Id
FROM AbpTenants
WHERE NOT EXISTS(SELECT TenantId
FROM PricingTier
WHERE TenantId = AbpTenants.Id)
But it returns nothing
How I need to write script to get correct data?