Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Other Forums
 MS Access
 select first and last within range x - how to ?

Author  Topic 

Planet_Jeroen
Starting Member

3 Posts

Posted - 2003-11-17 : 10:53:44
Hi all...

I'm not at all good with Access, I just know my way around the help. I made a database that stores logging information. Below table overview:

LOGS:
-LOGID => Key
-DATE/TIME => Obvious
-EVENTID => Which Event ?

Now I get thousands of events each day, and I want to be able to see the following:

Within a date time selection select the following:
Date/Time + Unique EventID + Count of occurence of EventID + Date First occurence and Date last occurence.

To do this I created the following table:
LOGS2:
-LOGID
-DATE/TIME } combined KEY
-EVENTID } combined KEY

Then I created querys that:
1st Query: make a date time selection on LOGS
2nd Query: append all records from LOGS to LOGS2 (filter out double occurences on key violation)
3rd Query: Select from LOGS2 everything and count for each record how many times the EventID occurs within the date time selection on LOGS

Now I realy want to be able to see the 'youngest' and 'oldest' occurence in LOGS as well.

MS Access help does not provide help on this, or I use the wrong keywords... any hints ???




Greetz

Planet_Jeroen
Starting Member

3 Posts

Posted - 2003-11-17 : 11:42:57
Reading this back I think should rephrase the last line..

quote:

Now I realy want to be able to see the 'youngest' and 'oldest' occurence in LOGS as well.



Translated to normal English (I hope) I ment the first Date/Time of the occurance and the last one.

Greetz
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2003-11-17 : 11:51:04
SELECT MAX(datetimeCol), MIN(datetimeCol)

???



Brett

8-)
Go to Top of Page

Planet_Jeroen
Starting Member

3 Posts

Posted - 2003-11-17 : 11:54:45
Thanx a lot ... I'm already off to the book store ;)

Greetz
Go to Top of Page
   

- Advertisement -