6

I how to fix this error message?

Unable to parse query string for Function QUERY parameter 2: CANNOT_GROUP_WITHOUT_AGG

I got that error message just from a simple query formula, I already tried to search about it and try with the curly bracket { ... } but it doesn't fixed, Can anyone help me or ever experienced it?

=QUERY(ANSWER!C:C, "SELECT * GROUP BY C", 0)

1 Answers1

12

If you don't have an agreggation function (such as sum, avg, count in SELECT), there is no use for GROUP BY - you may just delete it. If you wish to present unique records, use distinct instead.

Dimgold
  • 2,748
  • 5
  • 26
  • 49
  • I already add a count function `=QUERY(ANSWER!A:C, "SELECT A, B, C, COUNT(C) GROUP BY C", 0)` but why it's still give an error? `Unable to parse query string for Function QUERY parameter 2: ADD_COL_TO_GROUP_BY_OR_AGG: A` – Khrisna Gunanasurya Jun 10 '17 at 06:54
  • Because everything in select should be either aggregation function or in group by as well. And by the way - there is no logic in grouping by c and counting c at the same time. – Dimgold Jun 10 '17 at 12:17
  • 2
    So how to showing a list of email that unique? but showing I got a bunch of mails in column C, so that's why I use group by to sort it, is there any alternative way? by the way, in column A is a date of email. and Column B is a website of the email, so 1 email can be there multiple times with different date and websites. – Khrisna Gunanasurya Jun 12 '17 at 03:40