Re: cakephp find('count') + groub by problem

2010-02-23 Thread alagar
that would solve the problem, you need to write a query in such a way
$result = $this->find ( 'all', array ( 'fields'
=>'count(Client.ClientId)', 'group' => 'Client.ClientType'));
On Feb 23, 1:18 pm, alagar  wrote:
> problem is in Model __findCount method  
> seehttp://api12.cakephp.org/view_source/model/#line-2040
>
> On Feb 23, 12:57 pm, alagar  wrote:
>
> > Guys sorry for my English, I'm from Russia.
> > I have the following problem
> > There is a customer table with the fields id and type
> > I make such a request here
> > $result = $this->find ( 'count', array ( 'fields' =>
> > 'Client.ClientId', 'group' => 'Client.ClientType'));
> > I want to know the number of customers of various types;
> > Making debug($result); and get the number 2, then look at the query in
> > the debug panel
> > SELECT COUNT ( `Client`. `ClientId`) AS `count` FROM `Client` AS
> > `Client` GROUP BY `Client`. `ClientType`
> > now make
> > $ result = $ this-> query ( 'SELECT COUNT ( `Client`. `ClientId`) AS
> > `count` FROM `Client` AS `Client` GROUP BY `Client`. `ClientType`');
> > debug ($result);
> > see
> > Array
> > (
> >     [0] => Array
> >         (
> >             [0] => Array
> >                 (
> >                     [count] => 2
> >                 )
>
> >         )
>
> >     [1] => Array
> >         (
> >             [0] => Array
> >                 (
> >                     [count] => 10
> >                 )
>
> >         )
>
> > )
> > This is a cakephp bug or am I wrong create a compelling cost $ this->
> > find ?
> > 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


Re: cakephp find('count') + groub by problem

2010-02-23 Thread alagar
problem is in Model __findCount method  see 
http://api12.cakephp.org/view_source/model/#line-2040

On Feb 23, 12:57 pm, alagar  wrote:
> Guys sorry for my English, I'm from Russia.
> I have the following problem
> There is a customer table with the fields id and type
> I make such a request here
> $result = $this->find ( 'count', array ( 'fields' =>
> 'Client.ClientId', 'group' => 'Client.ClientType'));
> I want to know the number of customers of various types;
> Making debug($result); and get the number 2, then look at the query in
> the debug panel
> SELECT COUNT ( `Client`. `ClientId`) AS `count` FROM `Client` AS
> `Client` GROUP BY `Client`. `ClientType`
> now make
> $ result = $ this-> query ( 'SELECT COUNT ( `Client`. `ClientId`) AS
> `count` FROM `Client` AS `Client` GROUP BY `Client`. `ClientType`');
> debug ($result);
> see
> Array
> (
>     [0] => Array
>         (
>             [0] => Array
>                 (
>                     [count] => 2
>                 )
>
>         )
>
>     [1] => Array
>         (
>             [0] => Array
>                 (
>                     [count] => 10
>                 )
>
>         )
>
> )
> This is a cakephp bug or am I wrong create a compelling cost $ this->
> find ?
> 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


cakephp find('count') + groub by problem

2010-02-23 Thread alagar
Guys sorry for my English, I'm from Russia.
I have the following problem
There is a customer table with the fields id and type
I make such a request here
$result = $this->find ( 'count', array ( 'fields' =>
'Client.ClientId', 'group' => 'Client.ClientType'));
I want to know the number of customers of various types;
Making debug($result); and get the number 2, then look at the query in
the debug panel
SELECT COUNT ( `Client`. `ClientId`) AS `count` FROM `Client` AS
`Client` GROUP BY `Client`. `ClientType`
now make
$ result = $ this-> query ( 'SELECT COUNT ( `Client`. `ClientId`) AS
`count` FROM `Client` AS `Client` GROUP BY `Client`. `ClientType`');
debug ($result);
see
Array
(
[0] => Array
(
[0] => Array
(
[count] => 2
)

)

[1] => Array
(
[0] => Array
(
[count] => 10
)

)

)
This is a cakephp bug or am I wrong create a compelling cost $ this->
find ?
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