Can you please make up your mind, you said in your first post:

"Now, in the index view of the clients I need to show the date of last
report."

I honestly cant help you if you seem to not know what you want.

On Sep 11, 11:45 pm, sindbad <[email protected]> wrote:
> Not working. It shows me only the last date of the last report.
>
> On 12 sep., 00:38, Miles J <[email protected]> wrote:
>
> > Well if its for multiple clients, just remove the conditions array.
>
> > On Sep 11, 12:42 pm, sindbad <[email protected]> wrote:
>
> > > Okay,
>
> > > thanks for your reply but from where I get the $id. This should be
> > > Client.id but... this query selects only one row but I need to select
> > > only one row for each client. I have 1000 clients and 21290 reports.
> > > For every client I need to select the date of last report.
>
> > > On 11 sep., 21:52, Miles J <[email protected]> wrote:
>
> > > > Well you would have to grab the last date. Heres a query, assuming you
> > > > followed cake conventions.
>
> > > > $result = $this->Report->find('first', array(
> > > > 'fields' => 'Report.created',
> > > > 'order' => 'Report.id DESC',
> > > > 'conditions' => array('Report.client_id' => $id)
> > > > ));
>
> > > > Then echo it in the view: echo $result['Report']['created'];
>
> > > > On Sep 11, 11:42 am, sindbad <[email protected]> wrote:
>
> > > > > Hi,
>
> > > > > first of all I want to say that I'm new to cake but with a little help
> > > > > from book.cakephp.org and Google I've made a simple application for
> > > > > managing clients and reports for the clients.
> > > > > Each client has many raports. Now, in the index view of the clients I
> > > > > need to show the date of last report. This is what I don't know how to
> > > > > do it.
> > > > > I'll be glad if you could tell me how to select only the date of the
> > > > > last report for each of my clients.
> > > > > Thanks.
--~--~---------~--~----~------------~-------~--~----~
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