Results 1 to 3 of 3

Thread: last entries

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    May 2013
    Posts
    1,126

    last entries

    I have this DTR record. Employees have daily IN and OUT.

    I have this query select dtrdate,empid from DTR group by dtrdate desc,empid order by dtrdate desc limit 1 on mysql db.
    the problem with this is I get only for one employee. What I need to achieve is to get the last IN entries for all the employees.


    On ms access, I think that is Last().
    What is the proper way of the sql statement.
    Last edited by codesearcher; Dec 1st, 2015 at 10:10 AM.

  2. #2
    PowerPoster SamOscarBrown's Avatar
    Join Date
    Aug 2012
    Location
    NC, USA
    Posts
    9,176

    Re: last entries

    Does this work for you?

    Code:
    select dtrdate, empid from DTR group by dtrdate, empid order by dtrdate desc
    Just guessing without seeing your table

  3. #3
    Fanatic Member
    Join Date
    Apr 2015
    Location
    Finland
    Posts
    679

    Re: last entries

    Remove / ditch the 'limit 1' and use proper where clause, which selects only IN entries and limit those with max(date) or similar.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width