Max value from Query

Hi Experts,

I am at a loss for a select query that produces times that employees punches for the day. What I am struggling with is filtering the results to that only the last punch of the day is selected.  An example would be like this:

UniqueID    EmployeeID       TimeOut

268372524  100596              1713
268372525  100596              2344

The first punch for time out is actually a transfer from one job code to another and I want to remove that from my query.

Any help is appreciated.

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Rey Obrero (Capricorn1)Commented:
try this query

select t.*
from tableX as t
inner join
(select max(t2.timeout) as maxtimeout, t2.employeeid
 from tableX as t2
 group by t2.employeeid ) as t3
on t.employeeid=t3.employeeid and t.timeout=t3.maxtimeout


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
JJINFMAuthor Commented:
Thank you!  that did the trick.

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.