Click here to Skip to main content
15,888,401 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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
Posted

1 solution

Try this:
C#
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});
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900