具有多个表联接,排序和分组的Linq [英] Linq with multiple table joins, ordering and grouping

查看:76
本文介绍了具有多个表联接,排序和分组的Linq的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是LINQ的新手,但我想尝试一下.我正在制定一项医疗保健计划,并试图展示员工以及受抚养人的资金限制而陷入困境.

SQL中的查询是这样的:

I''m very new to LINQ, but thought I would give it a try. I am re building a health care program and have hit a block trying to display employees and there dependents money limits.

The query in SQL is something like this:

SELECT   e.employee, l.LIMIT, NVL (d.dependant, 0) dependant, l.limit_name, d.dependant_name, d.title ,   d.first_name , d.middle_name , d.last_name,DECODE (SUM (e.balance), NULL, ''N'', ''Y'') has_cash, DECODE (SUM (e.CHANGE), NULL, ''N'', ''Y'') has_cash_change, DECODE (SUM (e.balance_item), NULL, ''N'', ''Y'') has_item FROM PHSP.employee_limit e, PHSP.lt_limit l, PHSP.dependant d WHERE e.employee = :employee AND l.LIMIT = e.LIMIT AND e.dependant = d.dependant(+) GROUP BY e.employee, l.LIMIT, d.dependant, l.limit_name, d.dependant_name, d.title, d.first_name, d.middle_name, d.last_name
ORDER BY l.limit_name



我只是不知道从哪里开始联接,以及不知道如何在LINQ中对多列进行分组和排序.任何建议将不胜感激.

谢谢.



I just don''t know where to start with the joins, along with grouping and ordering by multiple columns in LINQ. Any advise would be much appreciated.

Thank you.

推荐答案

另请参阅以下内容

1) how-to-join-two-tables-using -linq-to-sql/ [ ^ ]
2) Linq-Group By [ ^ ]
3) join-and-group-by-linq-to-entities / [ ^ ]
4) linq-joins-and-groupings [ ^ ]
see these also

1) how-to-join-two-tables-using-linq-to-sql/[^]
2) Linq-Group By[^]
3) join-and-group-by-linq-to-entities/[^]
4) linq-joins-and-groupings[^]


请仔细阅读.
样本
Please go through this.
Samples


这篇关于具有多个表联接,排序和分组的Linq的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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