本文介绍了如何将Subquery Sql转换为lambda表达式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好

我有这个sql命令你可以帮帮我怎么用lambda表达式写这个?



选择A. *

来自Tablename一个内连接(选择地址,状态

来自Tablename

group by address,state

have count(*)> 1)B

on A.address = B.address和A.state = B.state



谢谢为您提供帮助

Hello
I have this sql command Could you help me How can I write this with lambda expression?

Select A.*
from Tablename A inner join (select address,state
from Tablename
group by address,state
having count(*)>1) B
on A.address=B.address and A.state=B.state

Thank for your help

推荐答案

var qry = TableA.AsEnumerable()
         .GroupBy(a=>new{a.address, a.state})
         .Where(grp.Count()>1)
         .Select(d=>new{address=d.Key.address, state=d.Key.state});


这篇关于如何将Subquery Sql转换为lambda表达式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-21 12:15