Reputation: 13
I have table like this (short brief).
error_code | timestamp(ISO string)
For every error_code a timestamp is added. I want to count all error codes and get something like this(using just one query):
error_code, count(error_code), sorted_timestamp
So I want to count all error occurence and get time stamp of last row inserted.
Any advice ?
Upvotes: 0
Views: 30
Reputation: 520978
You can try something like this:
SELECT error_code,
COUNT(*) AS error_count,
MAX(timestamp) AS latest_timestamp
FROM yourTable
GROUP BY error_code
Upvotes: 1