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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T12:47:36+00:00 2026-06-03T12:47:36+00:00

This is my query : var model = (from p in entity.vehicule join y

  • 0

This is my query :

var model = (from p in entity.vehicule
             join y in entity.indisponible on p.Matv equals y.idv
             where p.agence.idgov == idv && (!(dd1 >= y.Dd && dd1 <= y.Df) || !(df1 >= y.Dd && df1 <= y.Df))
             select p).ToList();

I have tried with many ways to write this part :

(!(dd1 >= y.Dd && dd1 <= y.Df) || !(df1 >= y.Dd && df1 <= y.Df))

In this way(this is how it has to be look in sql):

(dd1 Not Between Date(y.dd) And Date(y.dF)) OR (df1 Not Between Date(y.dd) And Date(y.df))

dd1 is date (From), Df1 is date (to).

I think I’m missing something here 🙁

  • 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-03T12:47:44+00:00Added an answer on June 3, 2026 at 12:47 pm

    Edit 2: After many comments, hopefully this is the result you’re after

    public IList<Car> GetCarsAvailable(DateTime fromDate, DateTime toDate)
    {
        var result = from c in dataContext.Cars
                     where !c.Bookings.Any(b => (fromDate >= b.From && fromDate <= b.To) || (toDate >= b.From && toDate <= b.To))
                     select c;
    
        return result.ToList();
    }
    

    Edit 1

    If we alter it slightly so instead of checking against a birthday, we’ll check against favourite days. Not let us assume that a person can have multiple favourite days, and that we want to select everyone that doesn’t have a favourite day, that is within 2 days. Let’s write out our assumptions further:

    • Richard‘s favourite days are, 5 May 2012 and 10 September 2012
    • Amy‘s favourite days are, 8 August 2012 and 12 December 2012
    • Matthews‘ favourite days is, 30 October 2012

    And let us say we want to find everyone who doesn’t have a favourite day between 1 May 2012 and 1 September 2012; our result output should only be Matthew, we could write:

    public IList<Person> GetPeopleWhoDontHaveAnyFavouriteDate(DateTime fromDate, DateTime toDate)
    {
        var result = from p in dataContext.People
                     where !p.FavouriteDates.Any(f => f.Date >= fromDate && f.Date <= toDate)
                     select p;
    
        return result.ToList();
    }
    

    What the above statement is saying, is we want to select all people, but only if none of their favourite dates are between two dates.

    Alternatively we could say, lets select a person, if they do have a date outside of a range. So assuming we wanted to check from 1 May 2012 to 1 November 2012, so our result set was now Richard and Amy, this could be achieved like so:

    public IList<Person> GetPeopleWhoDontHaveFavouriteDate(DateTime fromDate, DateTime toDate)
    {
        var result = from p in dataContext.People
                     where p.FavouriteDates.Any(f => f.Date < fromDate || f.Date > toDate)
                     select p;
    
        return result.ToList();
    }
    

    Original

    I found it tricky to read your abbreviated variables, so I hope you don’t mind but I thought I’d write a quick demo how to do a “not between” two dates.

    I think you’re on the right lines with things. Here are a couple of ways you could approach it. The following methods do the same thing, but one checks the inverse.

    public IList<Person> GetPeopleNotBornFromTo(DateTime fromDate, DateTime toDate)
    {
        var result = from p in dataContext.People
                     where p.DateOfBirth < fromDate || p.DateOfBirth > toDate
                     select p;
    
        return result.ToList();
    }
    
    public IList<Person> GetPeopleNotBornFromTo2(DateTime fromDate, DateTime toDate)
    {
        var result = from p in dataContext.People
                     where !(p.DateOfBirth >= fromDate && p.DateOfBirth <= toDate)
                     select p;
    
        return result.ToList();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I try to execute this query $qb = $this->_em->createQueryBuilder(); $qb->select(array('c', 'ld')) ->from('Model\Entity\Company', 'c') ->leftJoin('c.legaldetails',
When I execute this query: Dim Var Var = ("select max(Autonumber) from tblAutonumber") DoCmd.RunSQL
I have a LINQ query that is currently like this: var query = from
I have a Linq query that looks something like this: var query = from
I have this following IEnumerable LINQ query: var query = from p in Enumerable.Range(2,
I have this query this.FixturePartidoPuntaje.Load(); var partidos = from q in this.FixturePartidoPuntaje where (
When I use the query var NewMatchs = (from x in entity.matches select x).LastOrDefault();
i have this query: var model2 = (from p in context.ViewChatPeoples where ((IQueryable<int>)(from q
I am using this query: public IEnumerable.....{ var query = from d in Context.Documentos
So I have this query: var comm = @SELECT * FROM `TABLE` ; bool

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.