0

I am using Views Calc Module in drupal 7.

I want to calculate and show sum of price of products.

The Views Calc module giving error-

SQLSTATE[42000]: Syntax error or access violation: 1140 Mixing of GROUP columns
 (MIN(),MAX(),COUNT(),...) with no GROUP columns is illegal if there is no GROUP BY clause

Please help me What I do for resolve this problem and tell me if any alternate method.

codemania
  • 1,098
  • 1
  • 9
  • 26
tafsir
  • 311
  • 1
  • 3
  • 10

1 Answers1

0

Mixing of GROUP columns (MIN(),MAX(),COUNT(),...) with no GROUP columns is illegal if there is no GROUP BY clause.

Error message is very clear. You have to use group by clause to use aggregate functions on any column. That aggregation instruction should be passed through group by clause.

You need to frame your query something like this:

select 
  product_id,
  min(price) min_price,
  max(pric) max_price,
  count(product_id) product_count
from 
  products_table
group by
  product_id
Ravinder Reddy
  • 23,692
  • 6
  • 52
  • 82