Jump to content
Windows Dragon

Obter as ultimas 5 entradas numa base de dados...

Recommended Posts

Windows Dragon

Boas... Eu estou quase a terminar um site mt simples mas agora estou com um problema... eu tenho uma tabela em que vou adicionando dados... mas queria obter apenas os ultimos 5 dados adicionados á tabela...

Share this post


Link to post
Share on other sites
rjsma

Podes fazer da seguinte forma:

SELECT * FROM favoritos ORDER BY id DESC  LIMIT 0 , 5

Share this post


Link to post
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.