sql - how to find difference between no_of_value and no_of_distinct columns values? -
let number of city entries in station, , let number of distinct city names in station; query value of station. in other words, find difference between total number of city entries in table , number of distinct city entries in table.
input format
the station table described follows: enter image description here
where lat_n northern latitude , long_w western longitude.
you use having filtering resul on aggregated function
select city, count(*), count(distinct city) station group city having count(*) <> count(distinct city)
Comments
Post a Comment