-- SELECT EXTRACT(DOW FROM TIMESTAMP '2001-02-16 20:38:40');

select dato,count(hitid) from
(select EXTRACT(DOW FROM hitdatetime) as dato,hitid
 from Hit
 where
  CustomerID = (select customerid from customer
     where Customertext='pi.dk')
  and hitdatetime < 'now'::timestamp
  and hitdatetime > 'now'::timestamp-'1 year'::interval
) as d
group by dato;

