I want to calculate the difference between the results of 2 count(*)-type SELECT queries executed on 2 separate tables of my PostgreSQL database.
This w
You can write many query to answer this question like: As I am considering the question as we have table named as STATION and we have to now finding the difference between the total number of CITY entries in the table and the number of distinct CITY entries in the table
Query 1:
select (count(city)-count(distinct city)) from station;
Query 2:
select ((select count(city) as ans1 from station)-(select count(distinct city)
as ans2 from station));
Query 3:
select (( select count(city) from station )-( select count(distinct city) from station ))
as ans;
All the above mentioned query will work.