Re: count(*) how to retrieve?

2011-07-09 Thread gremlin
You can also use a virtualField in the DepartmentBook model. The virtualFields end up indexed into the correct array as if they were real fields - this means you don't have to shuffle your results around before using the data. I put together a little gist showing what I mean.

Re: count(*) how to retrieve?

2011-07-08 Thread Dominik Gajewski
Thanks for your reply 2011/7/8 Dr. Loboto drlob...@gmail.com: In case of $res = $this-DepartmentBook-find('all', array( 'fields' = array( 'count(*) AS kl', 'DepartmentBook.department_id'                                                                ), 'conditions' =      array(

count(*) how to retrieve?

2011-07-05 Thread Dominik Gajewski
Hi I would like to count some rows but i can't print results of query exactly - count(*) AS kl - on the screen. this is my query, and there is no error $res = $this-DepartmentBook-find('all', array( 'fields' = array(

Re: count(*) how to retrieve?

2011-07-05 Thread Tilen Majerle
instead of all use count to get number of records from database :) -- Lep pozdrav, Tilen Majerle http://majerle.eu 2011/7/6 Dominik Gajewski dominikgajews...@gmail.com Hi I would like to count some rows but i can't print results of query exactly - count(*) AS kl - on the screen. this is

Re: count(*) how to retrieve?

2011-07-05 Thread Dominik Gajewski
But 'count' returns only integer of value, and rest column?? And my first sql query returns this kl department_id 1 4 1 8 1 10 So only way is to create a own query?? $this-DepartmentBook-query(' SELECT count( * ) AS kl, ...'); 2011/7/6 Tilen Majerle tilen.maje...@gmail.com: instead of all

Re: count(*) how to retrieve?

2011-07-05 Thread Dominik Gajewski
I solved this problem. Maybe it is more complicated but it works $res = $this-DepartmentBook-find('all', array( 'fields' = array( 'count(*) AS kl', 'DepartmentBook.department_id', 'DepartmentBook.id' ), 'conditions' = array(