selecting the last row of the GROUP BY

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
REwingUK
Forum Commoner
Posts: 26
Joined: Wed Jul 29, 2009 8:46 pm

selecting the last row of the GROUP BY

Post by REwingUK »

How would i go about selecting the last row of the GROUP BY ?

Code: Select all

SELECT * FROM messaging INNER JOIN messaging_subject ON messaging.subject_id = messaging_subject.subjectID WHERE messaging.user_id = '$userID' GROUP BY messaging.conversation_id ORDER BY messaging.date_sent DESC 
Thanks in Advance
User avatar
social_experiment
DevNet Master
Posts: 2793
Joined: Sun Feb 15, 2009 11:08 am
Location: .za

Re: selecting the last row of the GROUP BY

Post by social_experiment »

Add 'LIMIT 1' to the end?
“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering
Post Reply