> In my admin area I want to show the following data:
>
> name, created, 1st Login, Last Login
Hiya!
This is probably one of those rare instances where a big ol' SQL query
would probably be easier than doing it at a higher level with CakePHP.
Something like this in the users' model might help:
function findUsersWithLoginInfo() {
$this->query("SELECT User.name, User.created, MIN(LoginLog.created),
MAX(LoginLog.created)
FROM users AS User
LEFT JOIN login_logs AS LoginLog ON User.id = LoginLog.user_id
GROUP BY User.id");
}
Then in the users' controller, you can simply assign the output of
$this->User->findUsersWithLoginInfo() to a variable.
Hope that helps,
Zoe.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---