INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Maximum and Minimum times

Maximum and Minimum times

(OP)
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

RE: Maximum and Minimum times

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

I would try:

Select [date], [name], MIN(Logintime), MAX(logouttime)
From MyTable
Group By [date], [name]


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.

RE: Maximum and Minimum times

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.

 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 

Duane
Hook'D on Access
MS Access MVP

RE: Maximum and Minimum times

(OP)
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

RE: Maximum and Minimum times

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

Skip,

glassesJust traded in my OLD subtlety...
for a NUance!tongue

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close