Click here to Skip to main content
15,886,026 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
I have 3 classes
Organization Table
orgId
orgName
partyId

Agency Table
agencyObjectId
partyId

Serice Table
serviceId
agencyObjectId


Agent
partyId
agentName


How to get service details for aget using agency table details

What I have tried:

I have tried
var result GetOrganizationdetails().Where(x=>x.agentPartyId = agentpartyid);
var result2 GetAgenydetails().Where(x=>x.agentPartyId = agentpartyid);

var result3 GetServicedetails().Where(x=>x.agencyObjectId= agencyObjectId);

<pre>var result4 GetAgenttails().Where(x=>x.partyId= partyId);


how to achieve using linq query
Posted
Comments
Richard Deeming 22-Dec-22 6:43am    
You say you have three classes, then show the properties for four classes with no obvious connection between them.

You'll need to join the tables together. But since you haven't shown any connection between the classes, we can't tell you how.

You're also using the assignment operator (=) where you should be using the equality operator (==) - but that's probably just a typo in your question.
Member 15090354 22-Dec-22 13:43pm    
How to convert from sql qery to linq
Select * from Employee emp where empId
in (select pId from EmpRelationShip where childId in (select pid from Employee emp1
Join EmpRelationShip emprs on emprs.cId= emp1.ahid
Where empObjectId in (select agencyobjectId from Employee
Where empid=384)
))
[no name] 23-Dec-22 7:53am    
https://learn.microsoft.com/en-us/answers/questions/96372/how-to-convert-raw-sql-to-entity-linq.html

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