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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T17:46:24+00:00 2026-06-11T17:46:24+00:00

I have a database with employee information and a program, which is supposed to

  • 0

I have a database with employee information and a program, which is supposed to retrieve data from this database.

The database structure seems like this:

ID | Date        | signedIn | SignedOut
1    01-10-2012    08:00:00   16:00:00
1    14-10-2012    08:00:00   16:00:00
1    13-09-2012    08:00:00   16:00:00

When I then try to retrieve data between 01-10-2012 and 15-10-2012 I want go get only the first two rows. So I get a total amount of hours worked to 16.

But right now I get the total amount to 24, because it also retrieves the last one, even though it is from last month

sql sentence:

SELECT Info.UserID, Info.SurName, Info.FirstName, timetabel.Date, 
FROM Info
INNER JOIN timestabel
ON Info.UserID = Bruger_tidstabel.UserID
WHERE Info.UserID = '1'
AND timetabel.Date >= '01-10-2012'
AND timetabel.Date <= '14-10-2012'"

the sentence works, so it can retrieve data from database.

Is there any way to tell the database, I am working with dates, so it will only retrieve data between two surden dates??

  • 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-11T17:46:25+00:00Added an answer on June 11, 2026 at 5:46 pm

    You can use the BETWEEN operator, it is used in a WHERE clause to select a range of data between two values.

    SELECT column_name(s)
     FROM table_name
     WHERE column_name
     BETWEEN value1 AND value2
    

    It is good idea your table field Date to be in date or time stamp format. Also, the year goes on front of the date format, like this:

    SELECT Info.UserID, Info.SurName, Info.FirstName, timetabel.Date, FROM Info INNER JOIN timestabel ON Info.UserID = Bruger_tidstabel.UserID WHERE Info.UserID = '1' AND timetabel.Date BETWEEN '2012-10-01' AND '2012-10-14'
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an EMPLOYEE table in a SQL Server 2008 database which stores information
Assume that I have a list of employee names from a database (thousands, potentially
I have a User, some of which are an employee. This is a one-to-one
I have a database which tries to acheive point-in-time information by having a master
We have a certain database that has some employee information, and I just wrote
I have the following tables in my database: Employee Table which consists of Name,
I have the following database design: Employee Table: Username, Name, DivisionCode Division Table: SapCode,
I have the following database design: Employee Table: Username, Name Quiz Table: QuizID, Title,
I have a database with few tables, ex.: Employee (Id, Name, state, country) Material
I am new to linqtosql. I have a database schema where, An employee can

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.