Skip to content
Advertisement

WHERE clause expression references [casted timestamp to date column] which is neither grouped nor aggregated at

This query should sum up all the records by Error_Type (nested) and by Application(nested) in the Failed_Record_Count column. Total_Record_Count column should sum up all the records from the table(excluding unnested tables). However, an error referencing to a.timestamp in the subquery is said to be neither grouped nor aggregated.

I noticed that when removing the “DATE” function from the select list, it successfully executes but doesn’t have my expected output. I am expecting that it would be grouped by date and not by timestamp, thus, Im trying to sum up the records by DATE and not by timestamp.

Please help.

Advertisement

Answer

The sub query is not considered as an aggregate function in the outer select statement. Hence, you have to add field 7 to group by as shown below:

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement