Tengo las siguientes tablas:
categorias
|------|--------|
| id | name |
|------|--------|
| 1 | c1 |
|------|--------|
| 2 | c2 |
|------|--------|
| 3 | c3 |
|------|--------|
items
|------|---------|--------|-------------|
| id | catid | name | modified_by |
|------|---------|--------|-------------|
| 1 | 1 | i1 | juan |
|------|---------|--------|-------------|
| 2 | 1 | i2 | pedro |
|------|---------|--------|-------------|
| 3 | 2 | i3 | pedro |
|------|---------|--------|-------------|
| 4 | 2 | i4 | josé |
|------|---------|--------|-------------|
| 5 | 3 | i5 | pedro |
|------|---------|--------|-------------|
Y Ejecuto la siguiente consulta:
SELECT c.id, c.name, COUNT(i.id) AS countid
FROM categories AS c
INNER JOIN items AS i ON i.catid = c.id
WHERE c.id IN (1,2,3) GROUP BY i.catid
Lo que quiero es agrupar la cantidad de ID's que tiene cada categoria al hacer el count de los items en esa categoria, pero me marca el siguiente error
#1055 - Expression #4 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'db.i.modified_by' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by
Si quito el atributo modified_by
en el select el error desaparece pero deseo mantenerlo. ¿Cómo puedo solucionar esto?