Linq to Entities 比较子查询中的日期时间
我正在尝试执行此子查询:
var query =
from cjto in oContext.t_table_1
join cav in oContext.t_table_2 on cjto.cd_code equals cav.cd_code
where cav.dt_time >=
(from tu in oContext.t_table3
where tu.vl_code == "ABCD"
select tu.dt_check_time)
select cav;
但是,我收到错误:
Operator '>=' cannot be applied to operands of type 'System.DateTime' and 'System.Linq.IQueryable<System.DateTime?>'
如何实现此类查询?
塔克斯
I'm trying to do this subquery:
var query =
from cjto in oContext.t_table_1
join cav in oContext.t_table_2 on cjto.cd_code equals cav.cd_code
where cav.dt_time >=
(from tu in oContext.t_table3
where tu.vl_code == "ABCD"
select tu.dt_check_time)
select cav;
However, I get the error:
Operator '>=' cannot be applied to operands of type 'System.DateTime' and 'System.Linq.IQueryable<System.DateTime?>'
How can I implement such query?
Tks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好的,我明白了...我需要添加 FirstOrDefault() 以便获取第一个元素
Tks
Ok, I got it... I needed to add the
FirstOrDefault()
so get the first elementTks