Click here to Skip to main content
15,029,433 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have three tables.I have to retrieve the data using linq statement.
my three table names are A,B,C.
I connected join for connecting two tables A.B based on the id's like

select ol, fN, LN, ci, co
from member
join details
on  member_id = details_id
where details_id in
(select contacts_id from contacts where
    contacts_id1 = 1 and contacts_usr_id = 1)

I am able to write the query upto where condition,can u help me how to write the query for the inner while condition..

It is urgent for me, please don't neglect this if u know the soln.
Updated 19-Jun-12 23:51pm
Pankaj Nikam 20-Jun-12 5:58am
Can you please provide the data structure of the 3 tables and tell me the output you wish to achieve so that I may help you with this...?
charan1431 20-Jun-12 6:20am
contacts table->contacts_id,contacts_id1,contacts_usr-id
member table->member_id,ol
details table -> FN,LN,CI,CO,details_id
I have multiple value with contact_id1 = 1 and contact_usr_id =1.
In the output i want to display ol,FN,LN,CI,CO .

Please Try this code.
List<int?> _contactsIds = (from t in _EntitiesModel.contacts
t.contacts_id1 == 1 && t.contacts_usr_id == 1
 select t.contacts_id ).ToList();

//// User  _contactsIds List for  inner condition
var _memberList = ( from m in _EntitiesModel.member 
                  join d in _EntitiesModel.details on m.member_id equals  d.details_id  where _contactsIds.Contains(d.details_id) select m).ToList();
this link will help you to fix your issue

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