select lower(IP.IPCountry) as country,count(hitid)
 from Hit H,IP IP
 where
  CustomerID = (select customerid from customer
     where Customertext='pi.dk')
  and H.IPID=IP.IPID
group by country;

select lower(IP.IPCountry) as country,sum(size)
 from Hit H,IP IP
 where
  CustomerID = (select customerid from customer
     where Customertext='pi.dk')
  and H.IPID=IP.IPID
  and hitdatetime < 'now'::timestamp
  and hitdatetime > 'now'::timestamp-'1 year'::interval
group by country;
