diff --git a/product/ERP5/bootstrap/erp5_mysql_ndb_catalog/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_ndb/z_count_results.xml b/product/ERP5/bootstrap/erp5_mysql_ndb_catalog/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_ndb/z_count_results.xml
index 1fd5d6b57e1120f27b791aea2e557c6d0cc5bbe8..b31a346dbc6d58a5e708ab67612f68e3064d09a5 100644
--- a/product/ERP5/bootstrap/erp5_mysql_ndb_catalog/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_ndb/z_count_results.xml
+++ b/product/ERP5/bootstrap/erp5_mysql_ndb_catalog/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_ndb/z_count_results.xml
@@ -166,6 +166,10 @@ WHERE\n
     <dtml-if expression> AND <dtml-var expression> </dtml-if>\n
   </dtml-let>\n
 </dtml-if>\n
+<dtml-if group_by_expression>\n
+GROUP BY\n
+  <dtml-var group_by_expression>\n
+</dtml-if>\n
 <dtml-if sort_on>\n
 ORDER BY\n
   <dtml-var sort_on>\n
diff --git a/product/ERP5/bootstrap/erp5_mysql_ndb_catalog/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_ndb/z_search_results.xml b/product/ERP5/bootstrap/erp5_mysql_ndb_catalog/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_ndb/z_search_results.xml
index 042eef8882a3ebcc89d62f61bf8e87b8c8c578c1..9a11e900c05d6f828226208ea4147863e2ab23f0 100644
--- a/product/ERP5/bootstrap/erp5_mysql_ndb_catalog/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_ndb/z_search_results.xml
+++ b/product/ERP5/bootstrap/erp5_mysql_ndb_catalog/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_ndb/z_search_results.xml
@@ -203,6 +203,10 @@ WHERE \n
     <dtml-if expression> AND <dtml-var expression> </dtml-if>\n
   </dtml-let>\n
 </dtml-if>\n
+<dtml-if group_by_expression>\n
+GROUP BY\n
+  <dtml-var group_by_expression>\n
+</dtml-if>\n
 <dtml-if sort_on>\n
 ORDER BY\n
   <dtml-var sort_on>\n
@@ -211,8 +215,6 @@ ORDER BY\n
 LIMIT <dtml-var "limit_expression">\n
 <dtml-else>\n
 LIMIT 1000\n
-</dtml-if>\n
-
 
 ]]></string> </value>
         </item>