Skip to content

Use the ip_to_province function to obtain the provinces based on the IP addresses, aggregate the data based on the ip_province field, and then calculate the number of clients in each province. The results are displayed on a map, in which the ip_province field indicates the province and the pv field indicates the number of clients.

sql
* |
select
  ip_to_province(client_ip) as ip_province,
  count(*) as pv
group by
  ip_province
order by
  pv desc
limit
  500