"SELECT * FROM proyects WHERE proyect_num >= MAX(pro

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
newlame
Forum Newbie
Posts: 2
Joined: Sat Feb 26, 2005 11:50 am

"SELECT * FROM proyects WHERE proyect_num >= MAX(pro

Post by newlame »

Help, I have a table called proyects with this fields:
proyect_num | date_added | filename | description | title

proyect_num is a auto_increment.


but I want to do something like this:

Code: Select all

"SELECT * FROM proyects WHERE proyect_num >= MAX(proyect_num) - 5"
So i want to select the last 5 proyect_num's, how can I do that?
newlame
Forum Newbie
Posts: 2
Joined: Sat Feb 26, 2005 11:50 am

Post by newlame »

don't need anymore help, I just figured it out:

Code: Select all

SELECT * FROM proyects ORDER BY proyect_num DESC LIMIT 5
Post Reply