Linq to sql mulitiple joins?

If the FK's are in place, normally you don't have to do the 'join' steps yourself with linq-to-sql, you can just reference the navigation properties. Also, keep in mind that you can use 'let' to define things in the query that might make it easier for you to make a query Since the FK is by way of lease having a SlipID, then it appears a given slip could have any number (0 .. *) of leases associated with it, although your logic seems to indicate it would be just 0 or 1 - if that's true, a nullable FK LeaseID on the slip might make more sense, but that's a tangent. For now I'll stick with the original SQL logic which was "any associated lease is expired var query = from slip in context.

Slips let expiredLeases = slip.Leases. Where(lease => lease. EndDate Today) where slip.Leases.Any() == false // no leases for this slip yet || expiredLeases.Any() // at least one associated lease is expired select slip You could still construct a query without navigation properties, of course, but I find it easier and much less error-prone to use the generated navigation properties instead of manually specifying the join and its condition :).

If the FK's are in place, normally you don't have to do the 'join' steps yourself with linq-to-sql, you can just reference the navigation properties. Also, keep in mind that you can use 'let' to define things in the query that might make it easier for you to make a query. Since the FK is by way of lease having a SlipID, then it appears a given slip could have any number (0 .. *) of leases associated with it, although your logic seems to indicate it would be just 0 or 1 - if that's true, a nullable FK LeaseID on the slip might make more sense, but that's a tangent.

For now I'll stick with the original SQL logic which was "any associated lease is expired" var query = from slip in context. Slips let expiredLeases = slip.Leases. Where(lease => lease.EndDate.

James, Thank you! Send up a flare so I can bow in appreciation in that direction. Thanks.

Tom – tkryton Jun 25 '10 at 4:13.

Below is my sql query in php. SELECT * FROM Tbl_Players I WHERE DATEDIFF( DAY , NOW( ) , I. FirstLoginTime is field in sql table which has value of DateTime.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions