mysql - query the number of non-unique elements in table -
let num
number of city entries in station, , numunique
number of unique cities. query value of num−numunique
station.
in other words, query number of non-unique city names in station subtracting number of unique city entries in table total number of city entries in table, has structure:
where lat_n northern latitude , long_w western longitude.
i have query returns wrong output.
select sum(count(city)) station group city having count(city)>1; b
select count(*) - count(distinct uniquevalue) table;
you need determine expression identifies city uniquely. name? combination of lat_n , long_w? might use (1000*lat_n + long_w), example.
Comments
Post a Comment