Hi Zoe,

Thanks for that, I had actually just worked it out exactly as you
said, a small problem is that it is a really slow query, but cacheing
should take care of that.

I also put it into a MySQL view and then made a Model of that, that
way I can treat it as a normal table.

Thanks for your help

Cheers

Mike

On Jan 28, 1:47 pm, MonkeyGirl <[EMAIL PROTECTED]> wrote:
> > 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 cake-php@googlegroups.com
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