PostgreSQL
 sql >> Database >  >> RDS >> PostgreSQL

Calcola la differenza tra i risultati di due query count(*) basate su 2 tabelle in PostgreSQL

Prova in questo modo:

select 
  (
    SELECT 
      "count"(*) as val1 
    from 
      tab1
  ) - (
    SELECT 
      "count"(*) as val2 
    from 
      tab2
  ) as total_count