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:

enter image description here

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

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

android - Keyboard hides my half of edit-text and button below it even in scroll view -