I've set of pages and each page has PageID
and will record unique visitors information IP
, Country
, Browser
, System
and Date
of visit
Here is sample of the database table
-------------------------------------------------------------------
| PageID | IP | Country | Browser | System | Date |
-------------------------------------------------------------------
| 1 | 00-00-00-1 | UK | Chrome | Win7 | 2016-05-22 |
-------------------------------------------------------------------
| 6 | 00-00-00-2 | France | Firefox | Win8 | 2016-05-25 |
-------------------------------------------------------------------
| 1 | 00-00-00-3 | USA | Firefox | WinXP | 2016-05-26 |
-------------------------------------------------------------------
| 8 | 00-00-00-4 | Spain | Opera | Android | 2016-05-28 |
-------------------------------------------------------------------
| 1 | 00-00-00-5 | UK | Chrome | Win10 | 2016-06-01 |
-------------------------------------------------------------------
| 8 | 00-00-00-6 | Italy | Safari |Kardishan| 2016-06-02 |
-------------------------------------------------------------------
| 5 | 00-00-00-7 | USA | Unknown | Android | 2016-06-02 |
-------------------------------------------------------------------
| 3 | 00-00-00-8 | UK | Firefox | Win7 | 2016-06-02 |
-------------------------------------------------------------------
My questions
1) How to make query to get top 3 countries where visitors comes from ? from the above sample the results should be :-
UK 3
USA 2
France 1
2) How to same query to get top 3 countries where visitors comes from where PageID = 1
from the above sample the results should be :-
UK 2
USA 1
~ that would helps me a lot to understand how statics can be generated, thanks