Event Log Query
Date: Mon, 22 Oct 2001 11:39:18 GMT
Message-ID: <3bd40057.11395593_at_news.easynet.co.uk>
In an event table, events are listed beside a time column.
Each event corresponds to a source_id and the point of time, accurately to the second, in which it took place.
The table contains precisely three weeks of continuous log.
I am able to query with SQL*PLUS to count the events for each source_id in the last n days:
SELECT source_id, count(*)
From event
WHERE time > TRUNC(SYSDATE-n)
GROUP BY source_id
ORDER BY count(*) DESC, source_id;
How could I achieve a result set to have several columns side by side, showing eight, four, two, and one days history of events for each source_id?
Obviously, there could only be one reverse ordered column, preferably the eight days history.
It may be simple but I do not know the secret.
Thanks for any help in advance.
Thomas Received on Mon Oct 22 2001 - 13:39:18 CEST
