-1

enter image description here

I have two tables and I need to choose the only id from the trip table that doesn't exist in the invoice detail table to ensure that trip use in only one invoice how can to make a query using LINQ to SQL.

Dale K
  • 25,246
  • 15
  • 42
  • 71
fawaz ali
  • 1
  • 1

1 Answers1

0

You can try something like the following:

db.Trip.Where(t => !db.Invoice_Detail
                      .Select(id => id.Trip_ID)
                      .Contains(t.ID))
       .Select(t => t.ID);
Ewean
  • 50
  • 1
  • 1
  • 11