hello

there are 2 Modele - User , Post -

TABLE `posts` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `user_id` int(11) ,
  `user1_id` int(11) ,
  `message` ,
  `is_read` tinyint(1) default '0',
  `created` int(11))


SQL Query is

select Users.name, p.co, p.nco
from
(select if(`user_id` = $user_id, user1_id, user_id) id,
       count(*) co,
       sum(if(is_read or (`user_id` = $user_id), 0, 1)) nco
 from posts
 where `user_id` = $user_id or user1_id = $user_id
 group by 1) p
   join
 Users on (Users.id = p.id)
 order by 3 desc


as I get the following SQL inquiry with CAKE ?

which Relations are  to put  in Models?

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to