Bonzo
Bonzo

Reputation: 13

Sqlite - join results from different queries

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

Answers (1)

Tim Biegeleisen
Tim Biegeleisen

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

Related Questions