Page 1 of 1

Nested select limit

Posted: Thu Feb 15, 2007 1:01 pm
by GeXus
Is it posible to do a nested select and limit 1?

Here is what I have...

Code: Select all

SELECT users.users_id AS users_id, users.name AS name, users.created_dt AS date, count( content.content_id ) AS contentcount, replace( DATEDIFF( content.created_dt, now( ) ) , '-', '' ) AS datediff, time_format( replace( TIMEDIFF( content.created_dt, now( ) ) , '-', '' ) , '%l' ) AS timediff
FROM users
LEFT JOIN content ON users.users_id = content.users_id
WHERE users.users_id = 27
AND users.active = '1' AND content.
GROUP BY users.name
ORDER BY users.name, users.created_dt
There is a many to one ratio for content and users. I only want the most recent of the contents, based on content.created_dt to be selected, right now it is selecting all of the contents.