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

  • Home
  • SEARCH
  • 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 90085
In Process

The Archive Base Latest Questions

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

I need a simple SQL to accomplish the below: Problem: When a petrol bunk

  • 0

I need a simple SQL to accomplish the below:

Problem:

When a petrol bunk runs out of fuel, the admin makes note of the DateTime (RunOutDate) when it ran out of fuel and notes also the DateTime (ResupplyDate) when the fuel supply was back on.

I need to create a report on how many days the bunk ran out of fuel.

eg.

1/1/1 10:10 to 1/1/1 10:50 should be counted as 1

1/1/1 10:10 to 2/1/1 07:20 should be counted as 2

1/1/1 23:55 to 2/1/1 00:10 should be counted as 2

I can not bank using hours using DateDiff as 24 hours could have spanned across 2 days.

TIA

  • 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. 2026-05-10T22:49:06+00:00Added an answer on May 10, 2026 at 10:49 pm
    DATEDIFF(d, RunOutDate, ResupplyDate) + 1 

    Remember that DATEDIFF always counts the number of BOUNDARIES that you cross. For days (first argument d), it counts the number of times the clock passed midnight. So to count the number of days covered you just add 1.

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

Sidebar

Ask A Question

Stats

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

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

    • 7 Answers
  • Editorial Team

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

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • added an answer You can create and set an invisible cursor theme. This… May 11, 2026 at 9:45 am
  • added an answer I'm not sure I quite understand your question, but if… May 11, 2026 at 9:45 am
  • added an answer char* in C++ is ANSI character string (usually one byte… May 11, 2026 at 9:45 am

Related Questions

I need a simple SQL to accomplish the below: Problem: When a petrol bunk
I need to construct some rather simple SQL, I suppose, but as it's a
I need a simple way to monitor multiple text log files distributed over a
I need a simple table with a user name and password field in MySQL.
I need a simple app to edit database tables. Are there any code generators
I need a simple window with three input boxes and three labels (login name,
I need a simple function which will take a FileInfo and a destination_directory_name as
For a random event generator I'm writing I need a simple algorithm to generate
I need a very simple and clear example of how to create an OCX
I need a robust and simple way to remove illegal path and file characters

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.