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 8495535
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T23:36:01+00:00 2026-06-10T23:36:01+00:00

Hi I have the below timecard structure on our system. From the above timecard

  • 0

Hi I have the below timecard structure on our system.

enter image description here

From the above timecard I need to generate a report that compares start from time_in AND end from time_out and group it by emp_id.

enter image description here

Any hint on how can I display it like the above would be great.

  • 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-06-10T23:36:03+00:00Added an answer on June 10, 2026 at 11:36 pm

    The following query does the job.

    SELECT date, emp_id, 
        MAX(IF(event='t_in',time_in - start, 0)) AS 't1_in_diff',
        MAX(IF(event='t_out',time_out - end, 0)) AS 't1_out_diff',
        MAX(IF(event='b1_in',time_in - start, 0)) AS 'b1_in_diff',
        MAX(IF(event='b1_out',time_out - end, 0)) AS 'b1_out_diff',
    FROM timecard 
    GROUP BY date, emp_id; 
    

    If results can be negative (time_in/time_out can be smaller than start/end), you should set 0 to a value that is always smaller than the difference.

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

Sidebar

Related Questions

I have below a function (from a previous question that went unanswered) that creates
I have below structure <div class=mybox> <div id=imageslide> <a href=><img src=url /></a> </div> </div>
I have below string String str=select * from m_menus; select * from m_roles; I
I have below table structure in MS SQL AirQuoteID Name SalesValue 7 M 49.50
I have below a code that will plot a sphere, it's proportions are defined
I have below combo box in mvvm-wpf application. I need to implement Text search
I have below a list of text, it is from a popular online game
I have below 2 Tables I need to get output witout temp tables WorkItem
What else needs to be validated apart from what I have below? This is
I have below a header file for a stack structure. what I don't understand

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.