I suggest you don't count the number of registrations every time an
event is being viewed! Instead I suggest you to use the counterCache!
See the CakePHP book at:
http://book.cakephp.org/view/816/counterCache-Cache-your-count

Thus when you find your list of events, the registration count will be
available for presentation.
Enjoy,
   John

On Apr 16, 1:05 am, mdb <meena.d...@gmail.com> wrote:
> Hello,
>
> I have Events view.ctp where i display list of Events (Event Name ,
> Location and Date)
>
> In EventRegistration table i have the users registered for each event.
> (Event id , UserId)
>
> Now in my EventView.ctp i need to add no. of registered users for each
> event.
>
> the SQL query will be
>
> Select a.EventName,a.EventLocation,a.Date,
> (Select count(*) from EventRegistraion b where b.EventId = a.EventID)
> as userscount
>  from Events a.
>
> How do i write the equivalent of this query in cakephp?
>
> Please Help

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

Reply via email to