MySQL DISTINCT + COUNT sorgu yardıma ihtiyacım var

0 Cevap php

Ben, "r" adında bir tablo var tablonun içinde ben id, ip, ve ülkeyi saklayın. Ben bu sorguyu çalıştırıyorum:

SELECT  r.country, count(rr.ip), count(DISTINCT rr.ip) 
FROM `r` 
LEFT JOIN r rr 
ON r.country = rr.country 
GROUP BY r.country

I do get rows with columns: "country";"number";"number"; But both "counts()" doesn not show what I want it to show (count of raw/unique ips for each country), and I am not sure why. For example for US I see >2000 unique ips, but I only have 500 entries in the database. What is wrong with my query?

Ne db almak istediğiniz sütun ile satırın bir listesi: ülkeler + ham ips + benzersiz ips saymak saymak. (Her ülkenin ilgili saymak), yani (çoklu sorguları yapmak zorunda kalmadan) farklı ülke ve sayma IP'lere foreach bir listesini almak.

0 Cevap