如何根据两个参数从两个表中选择不同的数据?
我有两个列表。 史坦顿 - 状态,造物质,..其他属性 定价 - 状态,造物质,..其他属性
我想选择状态和 chropyear pricings 表中的每个记录的 表中不存在于statenotes中。
示例:
statenotes
{State - Washington, CropYear - 2021 },
{State - Alabama, CropYear - 2022 },
{State - Nevada, CropYear - 2022 }
价格
{State - Washington, CropYear - 2021 },
{State - Alabama, CropYear - 2022 },
{State - Nevada, CropYear - 2021 } *<- this would be selected because there is no combination of Nevada-2021 in StateNotes*
我尝试的是:
var stateNotes = repository.AsQueryable<StateNotes>().ToList();
var newStates = pricings.Select(x => new { x.State, x.CropYear }).Except(stateNotes.Select(x => new { x.State, x.CropYear })).ToList();
I have two lists.
StateNotes - State, CropYear, ..Other properties
Pricings - State, CropYear, ..Other properties
I want to select State and CropYear of every record in Pricings table which is NOT present in StateNotes.
Example :
StateNotes
{State - Washington, CropYear - 2021 },
{State - Alabama, CropYear - 2022 },
{State - Nevada, CropYear - 2022 }
Pricings
{State - Washington, CropYear - 2021 },
{State - Alabama, CropYear - 2022 },
{State - Nevada, CropYear - 2021 } *<- this would be selected because there is no combination of Nevada-2021 in StateNotes*
What I tried :
var stateNotes = repository.AsQueryable<StateNotes>().ToList();
var newStates = pricings.Select(x => new { x.State, x.CropYear }).Except(stateNotes.Select(x => new { x.State, x.CropYear })).ToList();
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这应该起作用
的功能,您可以选择价格和史泰特人之间的区别
This should work
Whit that function you select the difference between pricings and stateNotes