Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 258275
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T22:10:01+00:00 2026-05-11T22:10:01+00:00

Using MS Access database I want to display today record min (time) and previous

  • 0

Using MS Access database

I want to display today record min (time) and previous day record max (time)

Table

PERSON ID  CARDEVENTDATE  CARDEVENTTIME
5008       20090805       080000
5008       20090805       140000
5008       20090809       180000
5008       20090809       220000
5008       20090813       090000
5008       20090813       200000
5008       20090818       110000
5008       20090818       232200
3405       20090805       080000
3405       20090805       180000
3405       20090809       070000
3405       20090809       230000
3010       20080806       090000
3010       20080806       230000
3010       20080810       100000
3010       20080810       160000

and so on…

From the above table I want to display Today min (time) and previous day max (time)

Previous day means not yesterday, previous cardeventtime for the particular person id.

Am using sub queries.

I am using below mentioned query.

"SELECT PERSONID, CARDEVENTDATE, MIN (CARDEVENTTIME) AS INTIME, 
    MAX (CARDEVENTTIME) AS OUTTIME FROM (SELECT T_PERSON.PERSONID, 
    T_CARDEVENT.CARDEVENTDATE, T_CARDEVENT.CARDEVENTTIME 
FROM (T_TITLE INNER JOIN T_PERSON ON T_TITLE.TITLECODE = T_PERSON.TITLECODE)
    INNER JOIN T_CARDEVENT ON T_PERSON.PERSONID = T_CARDEVENT.PERSONID 
WHERE T_CARDEVENT.CARDEVENTDATE BETWEEN '" & sdate & "' AND '" & edate & "' 
ORDER BY T_PERSON.TITLECODE) GROUP BY PERSONID, CARDEVENTDATE))"

But am not able to get previous day max (time). I want to get Today min (time) and previous day Max (time) for the particular person id.

Previous day means not yesterday, previous cardeventtime for the particular person id.

Expected Output.

PERSON ID  CARDEVENTDATE  MIN TIME  CARDEVENTDATE  MAX TIME
5008       20090818       110000    20090813       200000
5008       20090813       090000    20090809       220000
5008       20090809       180000    20090805       140000
3405       20090809       070000    20090805       180000
3010       20080810       100000    20080806       230000

and so on…

Need Query Help.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-11T22:10:02+00:00Added an answer on May 11, 2026 at 10:10 pm

    Scrap last answer.

    Let’s say you saved your query as DAYMINMAX.
    You’ll need to create another query:

    SELECT a.PERSONID  
         , MAX(b.CARDEVENTDATE) AS PREVDAY  
         , a.CARDEVENTDATE AS NEWDAY  
        FROM DAYMINMAX AS a INNER JOIN  
             DAYMINMAX AS b ON a.PERSONID = b.PERSONID  
                           AND a.CARDEVENTDATE > b.CARDEVENTDATE  
        GROUP BY a.PERSONID, a.CARDEVENTDATE  
    

    That query gives you one date and its previous date per person. Let’s name it DAYPREVNEW. Now you’ll need yet another one query (the one you want):

    SELECT a.PERSONID  
         , a.PREVDAY  
         , b.OUTTIME  
         , a.NEWDAY  
         , c.INTIME  
        FROM (DAYPREVNEW AS a INNER JOIN
             DAYMINMAX AS b ON a.PERSONID = b.PERSONID AND a.PREVDAY = b.CARDEVENTDATE) INNER JOIN DAYMINMAX AS c ON a.PERSONID = c.PERSONID AND a.NEWDAY = c.CARDEVENTDATE
    

    As your original query gets referenced so many times to create the answer needed, it is best to create it as a separate query than using sub-queries.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 231k
  • Answers 231k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Use the following function like this: Image('/path/to/original.image', '1/1', '150*', './thumb.jpg');… May 13, 2026 at 2:13 am
  • Editorial Team
    Editorial Team added an answer Check you database schema to see if the field (referenced… May 13, 2026 at 2:13 am
  • Editorial Team
    Editorial Team added an answer I figured out the problem - there was a session… May 13, 2026 at 2:13 am

Related Questions

USING MS ACCESS 2003 How to check is null value in the access database?
I use an ActiveX control called TAPIEx enabling TAPI phone system integration using MS
I was using MS-Access and Tomcat 6.0 previously for my application testing and it
Background info : I was handed a Tool, which was made using MS-Access 2007,

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.