>
> Hello all
>
> How can I run this query? I have been struggeling for hours.
>
> SELECT COUNT(DISTINCT(CIN_Number)) as NumberofCases, MMT_Number as
> NumberOfCase FROM material
>
>
It needs a GROUP BY clause in any case, but how are you trying to run it?
Using Zend_Db_Select?
$select = $db->select()
->from('material',
array(
'NumberOfCases' => new Zend_Db_Expr('COUNT(DISTINCT
CIN_Number)'),
'MMT_Number'
))
->group('MMT_Number');
Andrew
--
View this message in context: http://www.nabble.com/DISTINCT-SQL-Statement-tp24738814p24739770.html
Sent from the Zend DB mailing list archive at Nabble.com.
没有评论:
发表评论