ricardocoimbra Posted November 12, 2007 at 12:15 PM Report Share #146865 Posted November 12, 2007 at 12:15 PM Imaginemos que tenho um campo date e tenho isto 2007-11-12 2007-12-12 2008-01-12 2007-11-18 Imaginemos que eu cria selecionar os registo do mes de novembro deste ano como faria em mysql? Link to comment Share on other sites More sharing options...
RVG Posted November 12, 2007 at 12:30 PM Report Share #146866 Posted November 12, 2007 at 12:30 PM Boax... Existem varias maneiras .. Uma delas: SELECT * FROM tabela where extract(Year_month from Campo)=200711 ; ou SELECT * FROM tabela where Campo between 20071101 and 20071130; PS: Depois de voltar a ler a tua pergunta: SELECT * FROM tabela where extract(Year_month FROM Campo)=extract(year_month from now()); Para ter os registos do mes corrente. Link to comment Share on other sites More sharing options...
ricardocoimbra Posted November 12, 2007 at 02:29 PM Author Report Share #146883 Posted November 12, 2007 at 02:29 PM SELECT * FROM tabela WHERE extract(Year_month FROM Campo)=extract(year_month FROM now()); Era mesmo isso RVG obrigado! abraço Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now