SQL到LINQ查询转换问题。 [英] SQL to LINQ query conversion issue.

查看:64
本文介绍了SQL到LINQ查询转换问题。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是LINQ和EF的新手,试图将查询转换为LINQ.But无法获取它。





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, TU.email, 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.

推荐答案

您可以尝试下面的LINQ查询。



希望这个可以帮助你...

您可能需要检查WHERE子句。



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 
	  {
		TU.username, 
		TU.email, 
		TL.Logid
	  }).ToList();


这篇关于SQL到LINQ查询转换问题。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆