Jump to content

[Resolvido] Do banco de dados pegar registros do ultimos 3 meses


Vinny

Recommended Posts

Depemde da tua base de dados

MySQL: https://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html

Oracle: http://psoug.org/reference/date_func.html

PostgreSQL: http://www.postgresql.org/docs/9.1/static/functions-datetime.html

SQLite: http://www.sqlite.org/lang_datefunc.html

...

Por exemplo, com as funcoes add_months e today inventadas:

select count(*) from tabela where datainsercao > add_months(today(), -3)

What have you tried?

Não respondo a dúvidas por PM

A minha bola de cristal está para compor; deve ficar pronta para a semana.

Torna os teus tópicos mais atractivos e legíveis usando a tag CODE para colorir o código!

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.