Click here to Skip to main content
14,211,427 members
Rate this:
Please Sign up or sign in to vote.
I am a new one to LINQ and EF and trying to convert a query into LINQ.But unable to get it.

select  TU.username,, TL.Logid from TBL_A TU
left join  TBL_B TL on tu.userid = TL.userid
 where TU.teamid = 1001
 and Convert(Date,TL.logindt) = Convert(Date,getdate())
 and logid not in (select logid from  TBL_C where scheduleid = 8)

I have tried different approaches,

Tried to divide the query in subqueries and so on,, but unable to succeed.

ANy help would be appreciated.

1 solution

Rate this:
Please Sign up or sign in to vote.

Solution 1

Can you try the below LINQ query.

Hope that this one helps you out...
You might be needed to check the WHERE clause.

var query =( from TU in TBL_A 
	  join TL in TBL_B on  TU.userid equals TL.userid
	  where TU.teamid = 1001
	  select new 
VICK 22-May-14 23:59pm
You have just wrote the respective LINQ for the first part of query.. remaining 2 are still to be implemented and are actually the problematic part for me... :(

and secondly you missed the second where clause as well.. i.e.

and Convert(Date,TL.logindt) = Convert(Date,getdate())
Kumar Prateek 3-Jun-14 10:07am
Do let us know your solution for the same.
And I have already specified that you need to check the where clause which can be done very easily with the .net libraries.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Advertise | Privacy | Cookies | Terms of Service
Web01 | 2.8.190619.1 | Last Updated 22 May 2014
Copyright © CodeProject, 1999-2019
All Rights Reserved.
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100