SELECT `post_id`, MAX(`revision`) AS `revision` FROM `posts` GROUP BY
`post_id`

That gives you:

post_id  revision
1          3
2          2
3          1

Your query

SELECT MAX(revision) FROM posts WHERE post_id=$post_id)

Sounds good to me. Or if you want the rest of the data you could do:

SELECT * FROM `posts` WHERE `post_id`=$post_id ORDER BY `revision` DESC
LIMIT 1


-MI

---------------------------------------------------------------------------

Remember, smart coders answer ten questions for every question they ask. 
So be smart, be cool, and share your knowledge. 

BAKE ON!


--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the Google Groups 
"Cake PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to