Re: [postgresql-it] Presentazioni e problema: selezione 'parziale' per campo date

  • From: Matteo Beccati <php@xxxxxxxxxxx>
  • To: postgresql-it <postgresql-it@xxxxxxxxxxxxx>
  • Date: Thu, 29 Nov 2007 10:30:43 +0100

Ciao,

Tutti gli articoli acquistati in Agosto 2006

select        *
from articoli_acquistati 
where extract(year from data_acq) =2006 
and extract(month from data_acq) = 8

Io creerei un indice su data_acq e userei:

data_acq >= '2006-08-01' AND data_acq < '2006-08-01' + '1 month'::interval


-- 
Matteo Beccati

Openads - http://www.openads.org

Other related posts: