以下是我获得第一个结果的方法:
SELECT PageName, COUNT(DISTINCT Ip) as nb FROM statistique INNER JOIN visite ON statistique.Id = visite.IdPage GROUP BY statistique.Id;
这就是我得到的:PageName nb /edsa-PHP/index.php 1 /eds -PHP / test2.php 1 /PHP/index.php 3 /PHP/test2.php 1
PageName nb
/edsa-PHP/index.php 1
/edsa-PHP/test2.php 1
/PHP/index.php 3
/PHP/test2.php 1
我认为这可以获得计数的最大值:
SELECT MAX(nb) FROM (SELECT PageName, COUNT(DISTINCT Ip) as nb FROM statistique INNER JOIN visite ON statistique.Id = visite.IdPage GROUP BY PageName) AS t;