Skip to main content
added 1 character in body
Source Link
user1822
user1822

You can use conditional aggregation with an outer join

select count(*) filter (where at.asset_id is not null) with_unique_id, 
       count(*) filter (werewhere at.asset_id is null) as without_unique_id
from assets a
  left join associated_table at on at.asset_id = a.asset_id;

You can use conditional aggregation with an outer join

select count(*) filter (where at.asset_id is not null) with_unique_id, 
       count(*) filter (were at.asset_id is null) as without_unique_id
from assets a
  left join associated_table at on at.asset_id = a.asset_id;

You can use conditional aggregation with an outer join

select count(*) filter (where at.asset_id is not null) with_unique_id, 
       count(*) filter (where at.asset_id is null) as without_unique_id
from assets a
  left join associated_table at on at.asset_id = a.asset_id;
Source Link
user1822
user1822

You can use conditional aggregation with an outer join

select count(*) filter (where at.asset_id is not null) with_unique_id, 
       count(*) filter (were at.asset_id is null) as without_unique_id
from assets a
  left join associated_table at on at.asset_id = a.asset_id;