I have a query over several tables that should return a count value and one groupby column
I have the query set up and it works. I have tested the sql directly on the sql server and get the results I want. When my applications does the query though I only get one row of the result
Here my query and source code:
$q = Doctrine_Query::create()
->select('count(mp.idMember) as members, mp.idReason as reason')
->from('Member m, MemberPeriod mp, Org o')
->where('m.id=mp.id AND m.idOrg=o.idOrg AND o.tcode
LIKE \''.substr($this->getCode(), 0, 5) . '%\' AND mp.end >= \''.$quart->getStart().'\'
AND mp.end <= \''.$quart->getEnd().'\'')
$zu = $q->execute(array(), Doctrine_Core::HYDRATE_ARRAY);
which results in
SELECT COUNT([s2].[id]) AS [s2__0], [s2].[idreason] AS [s2__1]
FROM [Member] [s], [MemberPeriod] [s2], [Org] [s3]
WHERE ([s].[id] = [s2].[id] AND
[s].[idorg] = [s3].[idorg] AND
[s3].[tcode] LIKE '40111%' AND [s2].[end] >= '2010-01-01' AND
[s2].[end] <= '2010-03-31')
GROUP BY [s2].[idreason]
The print_r on $zu gives me
Array (  => Array ( [members] => 3 [reason] => 1 ) )
The result direct from the server is
I'm only getting the result from row 4.
can anyone help me here?