Originariamente inviato da whisher
Ciao.
E' possibile su un campo di tipo datetime
tipo questo per esempio :

selezionare i records che hanno
Y=2007
oppure
Y=2007+m=05
oppure
Y=2007+m=05+d=17

esempi chiarificatori sono assai graditi


codice:
select * from tabella
where year(campo_datetime) = 2007 

select * from tabella
where year(campo_datetime) = 2007 and month(campo_datetime) = 5 

select * from tabella
where year(campo_datetime) = 2007 and month(campo_datetime) = 5 
and day(campo_datetime) = 17


edit.
ancora

per la data esatta
codice:
select * from tabella
where date(campo_datetime) = '2007-05-17'
per anno e mese
codice:
select * from tabella
where extract(year_month from campo_datetime) = '200705'