SQLSTATE[42000]

1. Steps to reproduce

Make a clean fresh Drupal 7 install and stick to the default settings.
Install ctools and views.
Create one or two articles and fill in the default image field (=upload an image for each node).
Create a standard view, type page, for article types.
Change format to "show fields"
Add a field "Content: Image", select image style "thumbnail".
Add another field "Content: Image", select image style "large".
Until here, preview looks fine.
Now go to "advanced" an turn on aggregation.
Update the preview area if necessary and receive an error: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AS field_data_field_image_, node.created AS node_created, 'node' AS field_data_f' at line 1 See below for the full corresponding query.
Note the trailing dot/underscore which probably points to a missing variable or something else when constructing the field name/alias.

2a. What did not help
Trying to change the aggregation settings for each field did not help, in no way.

2b. How I worked around it

Go to fields section, select "rearrange" from the dropdown.
Remove both image fields.
Save the view.
Go to fields again, now add the two fields again as described above.
Problem is gone.
3. Possible cause
Without deeper analysis, I suspect that, when aggregation is active, something happens internally if you add a field. Some settings being made, whatever. This is probably omitted for fields which already exist when aggregation is turned on.

4. Affected/counter checks
As far as I have come, this only affects image fields. All other core fields worked fine and did not cause any problems. Looking at #5, however, reveals that obviously also link fields are affected, probably all fields dealing with file/path stuff?

Thanks anyway for the incredible great work on Views 3. Except for some pretty tiny odds, it is a fantastic tool I would never want to miss again! Thus, if I can be of any assistance in investigations or debug tasks, please let me know!

hth, dave

NB: The full query from my test (after enabling aggregation).
SELECT node.title AS node_title, node.nid AS nid, field_data_field_image. AS field_data_field_image_, node.created AS node_created, MIN(node.nid) AS nid_1, 'node' AS field_data_field_image_node_entity_type
FROM
{node} node
LEFT JOIN {field_data_field_image} field_data_field_image ON node.nid = field_data_field_image.entity_id AND (field_data_field_image.entity_type = 'node' AND field_data_field_image.deleted = '0')
WHERE (( (node.status = '1') AND (node.type IN ('article')) ))
GROUP BY node_title, nid, field_data_field_image_node_entity_type, field_data_field_image_, node_created
ORDER BY node_created DESC