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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T23:39:39+00:00 2026-06-08T23:39:39+00:00

I have two columns in the database, project_start and project_end, and I’m in passing

  • 0

I have two columns in the database, project_start and project_end, and I’m in passing two fields (both optional) via a report (coded in ASP).

The pseudo code below is what I currently have:

(project_start <= search_start AND project_end <= search_start)

AND

(project_start <= search_end AND project_end >= search_end)

However what the above doesn’t pick up are projects which start before the start date, but end after the start date, projects which start after the start date but end after the end date, and also projects which start before the start date and end after the end date :S

Below is my code:

if (Request.QueryString["DateFrom"] != null && Request.QueryString["DateFrom"] != "")
        {
            DateTime dateFromFilter;

            dateFromFilter = DateTime.Parse(Request.QueryString["DateFrom"]);

            Q = from qua in qTable
                    where qua.Start_Date.Date <= dateFromFilter.Date
                    && qua.End_Date.Date >= dateFromFilter.Date
                    select qua;
        }

        //filter to date
        if (Request.QueryString["DateTo"] != null && Request.QueryString["DateTo"] != "")
        {
            DateTime dateToFilter;

            dateToFilter = DateTime.Parse(Request.QueryString["DateTo"]);

            Q= from qua in qTable
                    where qua.Start_Date.Date <= dateToFilter.Date
                    && qua.End_Date.Date >= dateToFilter.Date
                    select qua;
        }
  • 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-08T23:39:41+00:00Added an answer on June 8, 2026 at 11:39 pm

    If you want the projects that overlap with any part of your search range, try this:

    project_start <= search_end AND project_end >= search_start
    

    I know it looks “too simple” but it does in fact cover all the cases:

    • Partial overlaps at both ends
    • The project being completely inside the search range
    • The search range being completely inside the project.

    Update

    To handle optional paramaters:

    (search_end IS NULL OR project_start <= search_end) AND
    (search_start IS NULL OR project_end >= search_start)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two columns(column1, column2) in my oracle database table named as demo .
Lets say we have a database table with two columns, entry_time and value. entry_time
In my database I have two columns named 'amount_raised' and 'funding_goal'. I would like
I have two columns say Main and Sub . (they can be of same
I have two columns. Column E extends up to 99504 (values) and column I
I have two columns in my NSOutlineView. One is a Text and image cell
I have two columns in a data frame, and I have been able to
I have two columns, each with many rows/divs. I'm trying to get jQuery UI
I have two columns A and B, and would like to get a list
I have two columns. ColA and ColB contains char(10) with data 20090520 and 20090521.

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.