Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Maximum and Minimum times 1

Status
Not open for further replies.

ptrifile

Technical User
Aug 10, 2004
457
US
I have a table called tblLoginLogout that has 4 fields. Date, Name, Logintime, and Logouttime. The data looks like this:

date name Logintime logouttime
2/8/2016 Joe blow 8:00 am 9:02 pm
2/8/2016 Joe blow 9:04 am 10:02 am
2/8/2016 Joe blow 10:03 am 2:00 pm
2/8/2016 Joe blow 2:02 am 5:00 pm
2/9/2016 Joe blow 8:04 am 5:03pm
2/10/2016 Joe blow 8:00 am 12:00pm
2/10/2016 Joe blow 1:00 pm 5:00 pm

I am trying to create a new table with only the records that show the minimum login time and the maximum logout time for each person for each date. So the new table in the above example would look like this:

date name Logintime logouttime
2/8/2016 Joe blow 8:00 am 5:00 pm
2/9/2016 Joe blow 8:04 am 5:03 pm
2/10/2016 Joe blow 8:00 am 5:00 pm

Is this possible to do? Can anyone point me in the right direction?

Thanks in advance!

Paul
 
Assuming date, Logintime, and logouttime are DateTime fields, not just test.

I would try:
[tt]
Select [date], [name], MIN(Logintime), MAX(logouttime)
From MyTable
Group By [date], [name]
[/tt]

BYW - bad names for fields: date and name, Those are 'reserved words' in Access.

Have fun.

---- Andy

A bus station is where a bus stops. A train station is where a train stops. On my desk, I have a work station.
 
Ptrifile,
You have created over 180 threads in Tek-Tips so we might expect you to use TGML to properly format your posts. This makes it much easier for tippers to assist you.

[pre]
date name Logintime logouttime
2/8/2016 Joe blow 8:00 am 9:02 pm
2/8/2016 Joe blow 9:04 am 10:02 am
2/8/2016 Joe blow 10:03 am 2:00 pm
2/8/2016 Joe blow 2:02 am 5:00 pm
2/9/2016 Joe blow 8:04 am 5:03pm
2/10/2016 Joe blow 8:00 am 12:00pm
2/10/2016 Joe blow 1:00 pm 5:00 pm[/pre]

Duane
Hook'D on Access
MS Access MVP
 
Thanks Andy! While you're exact answer didn't work it absolutely helped me get to where I needed to be! Thanks!

Dhookom, my appologies. I will look into the TGML for future posts.

Paul
 
Yes and PREVIEW your posts and make appropriate adjustments before SUBMITing your POST or use the EDIT feature.

Skip,

[glasses]Just traded in my OLD subtlety...
for a NUance![tongue]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top