johanafm;10997733 wrote:LEFT JOIN (
SELECT user_id, MAX(logins.logindate) as logdate
FROM logins
GROUP by user_id
) AS l ON l.user_id = user.id
Johanafm, do you mean to use with togheter with the other leftjoin?
Im working with Zend Framework and got this, but still the result not order correctly:
SELECT rma., logg., date.rma_entity_id, MAX(date.created_at)
FROM rma_entity AS rma
LEFT JOIN rma_logg AS logg ON rma.entity_id=logg.rma_entity_id
LEFT JOIN rma_logg AS date ON date.logg_id=logg.logg_id
GROUP BY rma.entity_id
ORDER BY logg.created_at DESC
The problems seemse to be when its more then one logged entry for any of the posts.
Do you see where I doing wrong?